omit-keys
Version:
Return a copy of an object without the given keys.
30 lines (23 loc) • 819 B
JavaScript
/*!
* omit-key <https://github.com/jonschlinkert/omit-key>
*
* Copyright (c) 2014 Jon Schlinkert, contributors.
* Licensed under the MIT License
*/
;
var should = require('should');
var omit = require('./');
describe('.omit()', function () {
it('should omit the given key from the object.', function () {
omit({a: 'a', b: 'b', c: 'c'}, 'a').should.eql({ b: 'b', c: 'c' });
});
it('should omit the given keys from the object.', function () {
omit({a: 'a', b: 'b', c: 'c'}, ['a', 'c']).should.eql({ b: 'b' });
});
it('should return the object if no keys are specified.', function () {
omit({a: 'a', b: 'b', c: 'c'}).should.eql({a: 'a', b: 'b', c: 'c'});
});
it('should return an empty object if no object is specified.', function () {
omit().should.eql({});
});
});