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

assocPath-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
import {assocPath} from 'rambda'
interface Output { a: number, foo: {bar: number},}
describe('R.assocPath - user must explicitly set type of output', () => { it('with array as path input', () => { const result = assocPath<Output>(['foo', 'bar'], 2, {a: 1})
result // $ExpectType Output }) it('with string as path input', () => { const result = assocPath<Output>('foo.bar', 2, {a: 1})
result // $ExpectType Output })})
describe('R.assocPath - curried', () => { it('with array as path input', () => { const result = assocPath<Output>(['foo', 'bar'], 2)({a: 1})
result // $ExpectType Output }) it('with string as path input', () => { const result = assocPath<Output>('foo.bar', 2)({a: 1})
result // $ExpectType Output })})
rambda

Version Info

Tagged at
2 months ago