Skip to main content
Module

x/rambda/evolve-spec.ts

Faster and smaller alternative to Ramda
Go to Latest
File
import {evolve, add} from 'rambda'
describe('R.evolve', () => { it('happy', () => { const input = { foo: 2, nested: { a: 1, bar: 3, }, } const rules = { foo: add(1), nested: { a: add(-1), bar: add(1), }, } const result = evolve(rules, input) const curriedResult = evolve(rules)(input)
result.nested.a // $ExpectType number curriedResult.nested.a // $ExpectType number result.nested.bar // $ExpectType number result.foo // $ExpectType number }) it('with array', () => { const rules = [String, String] const input = [100, 1400] const result = evolve(rules, input) const curriedResult = evolve(rules)(input) result // $ExpectType readonly string[] curriedResult // $ExpectType readonly string[] })})