deno.land / x / rambda@v9.1.1 / source / path-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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import {path} from 'rambda'
const input = {a: {b: {c: true}}}
describe('R.path with string as path', () => { it('without specified output type', () => { // $ExpectType unknown path('a.b.c', input) // $ExpectType unknown path('a.b.c')(input) }) it('with specified output type', () => { // $ExpectType boolean | undefined path<boolean>('a.b.c', input) // $ExpectType boolean | undefined path<boolean>('a.b.c')(input) })})
describe('R.path with list as path', () => { it('with array as path', () => { // $ExpectType boolean path(['a', 'b', 'c'], input) // $ExpectType unknown path(['a', 'b', 'c'])(input) }) test('shallow property', () => { // $ExpectType number path(['a'], {a: 1})
// $ExpectType unknown path(['b'], {a: 1}) }) test('deep property', () => { const testObject = {a: {b: {c: {d: {e: {f: 1}}}}}} const result = path(['a', 'b', 'c', 'd', 'e', 'f'], testObject) // $ExpectType number result const curriedResult = path(['a', 'b', 'c', 'd', 'e', 'f'])(testObject) // $ExpectType unknown curriedResult }) test('issue #668 - path is not correct', () => { const object = { is: { a: 'path', }, } const result = path(['is', 'not', 'a'], object) // $ExpectType unknown result const curriedResult = path(['is', 'not', 'a'])(object) // $ExpectType unknown curriedResult })})
rambda

Version Info

Tagged at
2 months ago