mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-26 17:46:26 +03:00
Replace indexOf with includes, startsWith
This replaces almost every instance of indexOf on both String and Array. There are very few places where we really wanted an index. Mostly, indexOf was used to check for inclusion. Change-Id: I08e299768b6ffdb4bfc30b39b5d82a058c6d1b56
This commit is contained in:
@@ -42,20 +42,6 @@ describe('ArrayUtils', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('indexOf', function() {
|
||||
it('will find a matching element', function() {
|
||||
let arr = ['aaa', 'bbb', 'ccc'];
|
||||
let comparator = function(a, b) { return a[0] === b[0]; };
|
||||
expect(ArrayUtils.indexOf(arr, 'bat', comparator)).toBe(1);
|
||||
});
|
||||
|
||||
it('will return -1 if not found', function() {
|
||||
let arr = ['aaa', 'bbb', 'ccc'];
|
||||
let comparator = function(a, b) { return a[0] === b[0]; };
|
||||
expect(ArrayUtils.indexOf(arr, 'zoo', comparator)).toBe(-1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('hasSameElements', function() {
|
||||
it('determines same elements', () => {
|
||||
expectEqual([], []);
|
||||
|
||||
Reference in New Issue
Block a user