Example #1
0
 it('should return the same data type', function() {
   var result = _.identity([1, 2, 3]);
   expect(Array.isArray(result)).to.equal(true);
   var nums = _.identity(4567);
   expect(Number.isInteger(nums)).to.equal(true);
   var str = _.identity('hello world!');
   expect(typeof str).to.be.a('string');
   var undef = _.identity(undefined);
   expect(undef).to.be.a('undefined');
   var boolean = _.identity(true);
   expect(boolean).to.be.a('boolean');
   var nul = _.identity(null);
   expect(nul).to.be.a('null');
 });
Example #2
0
 it('should return the given value', function() {
   var result = _.identity(5);
   expect(result).to.equal(5);
 });