deno.land / x / rambda@v9.1.1 / source / updateObject.spec.js

updateObject.spec.js
نووسراو ببینە
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
import { updateObject } from './updateObject.js'
const obj = { a : { b : 1 }, foo : { bar : 10 },}const rules = [ [ 'a.b', 2 ], [ 'foo.bar', 20 ], [ 'q.z', 300 ],]const expected = { a : { b : 2 }, foo : { bar : 20 }, q : { z : 300 },}
test('happy', () => { const result = updateObject(rules, obj) expect(result).toEqual(expected)})
test('curried', () => { const result = updateObject(rules)(obj) expect(result).toEqual(expected)})
rambda

Version Info

Tagged at
2 months ago