Remove lodash isNaN, isNumber, isString, bind, uniqBy

(re: 6087)
This commit is contained in:
Bryan Housel
2019-03-27 23:11:08 -04:00
parent 6fb8fcb86b
commit 3896b2282f
12 changed files with 130 additions and 74 deletions
+34
View File
@@ -81,4 +81,38 @@ describe('iD.utilArray', function() {
});
});
describe('utilArrayUniqBy', function() {
var pets = [
{ type: 'Dog', name: 'Spot' },
{ type: 'Cat', name: 'Tiger' },
{ type: 'Dog', name: 'Rover' },
{ type: 'Cat', name: 'Leo' }
];
it('groups by key property', function() {
var expected = [
{ type: 'Dog', name: 'Spot' },
{ type: 'Cat', name: 'Tiger' }
//{ type: 'Dog', name: 'Rover' }, // not unique by type
//{ type: 'Cat', name: 'Leo' } // not unique by type
];
expect(iD.utilArrayUniqBy(pets, 'type')).to.eql(expected);
});
it('groups by key function', function() {
var expected = [
{ type: 'Dog', name: 'Spot' },
{ type: 'Cat', name: 'Tiger' },
//{ type: 'Dog', name: 'Rover' }, // not unique by name length
{ type: 'Cat', name: 'Leo' }
];
var keyFn = function(item) { return item.name.length; };
expect(iD.utilArrayUniqBy(pets, keyFn)).to.eql(expected);
});
it('undefined key function', function() {
expect(iD.utilArrayUniqBy(pets)).to.eql([]);
});
});
});