Skip to main content
Module

x/rambda/source/omit.spec.js

Faster and smaller alternative to Ramda
Latest
File
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' })})