Skip to main content
Module

x/rambda/partition-spec.ts

Faster and smaller alternative to Ramda
Go to Latest
File
import {partition} from 'rambda'
describe('R.partition', () => { it('with array', () => { const predicate = (x: number) => { return x > 2 } const list = [1, 2, 3, 4]
const result = partition(predicate, list) const curriedResult = partition(predicate)(list) result // $ExpectType readonly [readonly number[], readonly number[]] curriedResult // $ExpectType readonly [readonly number[], readonly number[]] })
/* TODO revert to old version of `dtslint` and `R.partition` typing as there is diff between VSCode types(correct) and dtslint(incorrect) it('with object', () => { const predicate = (value: number, prop?: string) => { return value > 2 } const hash = { a: 1, b: 2, c: 3, d: 4, } const result = partition(predicate, hash) const curriedResult = partition(predicate)(hash) result[0] // $xExpectType { [key: string]: number; } result[1] // $xExpectType { [key: string]: number; } curriedResult[0] // $xExpectType { [key: string]: number; } curriedResult[1] // $xExpectType { [key: string]: number; } }) */})