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

modifyPath.spec.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { modifyPath } from './modifyPath.js'
test('happy', () => { const result = modifyPath( 'a.b.c', x => x + 1, { a : { b : { c : 1 } } } ) expect(result).toEqual({ a : { b : { c : 2 } } })})
test('with array', () => { const input = { foo : [ { bar : '123' } ] } const result = modifyPath( 'foo.0.bar', x => x + 'foo', input ) expect(result).toEqual({ foo : { 0 : { bar : '123foo' } } })})
rambda

Version Info

Tagged at
2 months ago