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

lensSatisfies-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
import {lensSatisfies, lensIndex, lensPath} from 'rambda'
describe('R.lensSatisfies', () => { it('with list', () => { const list = [1, 2, 3] const lens = lensIndex(0) const predicate = (x: number) => x > 2 const result = lensSatisfies<number>(predicate, lens, list) result // $ExpectType boolean
const curriedResult = lensSatisfies<number>(predicate, lens)(list) curriedResult // $ExpectType boolean }) it('with object', () => { const input = {a: {b: {c: 1}}} const lens = lensPath('a.b.c') const predicate = (x: number) => x > 1 const result = lensSatisfies(predicate, lens, input) result // $ExpectType boolean
const curriedResult = lensSatisfies(predicate, lens)(input) curriedResult // $ExpectType boolean })})
rambda

Version Info

Tagged at
7 months ago