Skip to content

Commit

Permalink
adding shallow version for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
selfcontained committed May 8, 2013
1 parent 1f97621 commit a6c1a5c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
9 changes: 9 additions & 0 deletions shallow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var lib = require('./lib/deap');

var deap = module.exports = lib.extendShallow;

deap(deap, {
clone: lib.clone,
extend: lib.extendShallow,
merge: lib.mergeShallow
});
22 changes: 22 additions & 0 deletions test/shallow.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
var assert = require('chai').assert,
lib = require('../lib/deap'),
shallow = require('../shallow');

describe('shallow', function() {

it('should be defined correctly', function() {
assert.isFunction(shallow);

assert.isFunction(shallow.extend);
assert.isFunction(shallow.merge);
assert.isFunction(shallow.clone);
});

it('should be shallow functions', function() {
assert.equal(shallow, lib.extendShallow);
assert.equal(shallow.extend, lib.extendShallow);
assert.equal(shallow.merge, lib.mergeShallow);
assert.equal(shallow.clone, lib.clone);
});

});

0 comments on commit a6c1a5c

Please sign in to comment.