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

propEq-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
import {propEq} from 'rambda'
const property = 'foo'const numberProperty = 1const value = 'bar'const obj = {[property]: value}const objWithNumberIndex = {[numberProperty]: value}
describe('R.propEq', () => { it('happy', () => { const result = propEq(value, property, obj) result // $ExpectType boolean })
it('number is property', () => { const result = propEq(value, 1, objWithNumberIndex) result // $ExpectType boolean })
it('with optional property', () => { interface MyType { optional?: string | number, }
const myObject: MyType = {} const valueToFind = '1111' // @ts-expect-error propEq(valueToFind, 'optional', myObject) })
it('imported from @types/ramda', () => { interface A { foo: string | null, } const obj: A = { foo: 'bar', } const value = '' const result = propEq(value, 'foo')(obj) result // $ExpectType boolean
// @ts-expect-error propEq(value, 'bar')(obj) })})
rambda

Version Info

Tagged at
2 months ago