Skip to main content
Module

x/rambda/both-spec.ts

Faster and smaller alternative to Ramda
Go to Latest
File
import {both} from 'rambda'
describe('R.both', () => { it('with passed type', () => { const fn = both<number>( x => x > 1, x => x % 2 === 0 ) fn // $ExpectType Predicate<number> const result = fn(2) // $ExpectType boolean result // $ExpectType boolean }) it('with passed type - curried', () => { const fn = both<number>(x => x > 1)(x => x % 2 === 0) fn // $ExpectType Predicate<number> const result = fn(2) result // $ExpectType boolean }) it('no type passed', () => { const fn = both( x => { x // $ExpectType any return x > 1 }, x => { x // $ExpectType any return x % 2 === 0 } ) const result = fn(2) result // $ExpectType boolean }) it('no type passed - curried', () => { const fn = both((x: number) => { x // $ExpectType number return x > 1 })((x: number) => { x // $ExpectType number return x % 2 === 0 }) const result = fn(2) result // $ExpectType boolean })})