deno.land / x / rambda@v9.1.1 / source / evolve-spec.ts

evolve-spec.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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 string[] curriedResult // $ExpectType string[] })})
rambda

Version Info

Tagged at
2 months ago