Sha256: 79db5661613253d5c1d42bd457bb412465639b5bbc4d3001a6843243c3f80e11
Contents?: true
Size: 1.15 KB
Versions: 92
Compression:
Stored size: 1.15 KB
Contents
/** * Module dependencies. */ var object = require('..'); describe('.keys(obj)', function(){ it('should return the keys of an object', function(){ var obj = { name: 'tobi', age: 1 }; object.keys(obj).should.eql(['name', 'age']); }) }) describe('.values(obj)', function(){ it('should return the values of an object', function(){ var obj = { name: 'tobi', age: 1 }; object.values(obj).should.eql(['tobi', 1]); }) }) describe('.length(obj)', function(){ it('should return key count', function(){ var obj = { name: 'tobi', age: 1 }; object.length(obj).should.equal(2); }) }) describe('.merge(a, b)', function(){ it('should merge two objects', function(){ var a = { foo: 'bar' }; var b = { bar: 'baz' }; object.merge(a, b).should.eql({ foo: 'bar', bar: 'baz' }); }) it('should give precedence to b', function(){ var a = { foo: 'bar' }; var b = { foo: 'baz' }; object.merge(a, b).should.eql({ foo: 'baz' }); }) }) describe('.isEmpty()', function(){ it('should check if the object is empty', function(){ object.isEmpty({}).should.be.true; object.isEmpty({ foo: 'bar' }).should.be.false; }) })
Version data entries
92 entries across 92 versions & 4 rubygems