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

نووسراو ببینە
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
import { omit } from './omit.js'
test('with string as condition', () => { const obj = { a : 1, b : 2, c : 3, } const result = omit('a,c', obj) const resultCurry = omit('a,c')(obj) const expectedResult = { b : 2 }
expect(result).toEqual(expectedResult) expect(resultCurry).toEqual(expectedResult)})
test.only('with number as property to omit', () => { const obj = { 1 : 1, b : 2, } const result = omit([ 1 ], obj) expect(result).toEqual({ b : 2 })})
test('with null', () => { expect(omit('a,b', null)).toBeUndefined()})
test('happy', () => { expect(omit([ 'a', 'c' ])({ a : 'foo', b : 'bar', c : 'baz', })).toEqual({ b : 'bar' })})
rambda

Version Info

Tagged at
2 months ago