These are chat archives for ramda/ramda

26th
Mar 2018
Rajinder Yadav
@rajinder-yadav
Mar 26 2018 03:29
@riston
import { pluck } from 'ramda';

interface User {
  name: string;
  age: number;
}

const persons: User[] = [
  { name: 'dsadsa', age: 21},
  { name: 'a', age: 4},
];

const names = pluck<string, any>('name', persons);
console.log(persons, names);
Risto Novik
@riston
Mar 26 2018 06:16
@rajinder-yadav yes that's possible but using any is loosing the point of TS.
Alec
@alavkx
Mar 26 2018 17:38

@bayandem I'm guessing you want the head of an array, still contained in an array?
So in this case your intended (?) output would be [1]

If thats the case, use R.of

@ram-bot
R.pipe(R.head, R.of)([1,2])
ram-bot
@ram-bot
Mar 26 2018 17:39
[ 1 ]
Ben Briggs
@ben-eb
Mar 26 2018 22:16
@ram-bot
R.slice(0, 1, [1, 2])
ram-bot
@ram-bot
Mar 26 2018 22:16
[ 1 ]