Skip to main content
Module

x/rambda/pluck-spec.ts

Faster and smaller alternative to Ramda
Go to Latest
File
import {pluck} from 'rambda'
describe('R.pluck', () => { it('with object', () => { interface ListMember { a: number, b: string, } const input: ListMember[] = [ {a: 1, b: 'foo'}, {a: 2, b: 'bar'}, ] const resultA = pluck('a', input) const resultB = pluck('b')(input) resultA // $ExpectType readonly number[] resultB // $ExpectType readonly string[] })
it('with array', () => { const input = [ [1, 2], [3, 4], [5, 6], ] const result = pluck(0, input) const resultCurry = pluck(0)(input) result // $ExpectType readonly number[] resultCurry // $ExpectType readonly number[] })})