replaced ko.utils.array* with native

This commit is contained in:
djmaze 2020-10-28 20:17:45 +01:00
parent 20b1e08c9b
commit d49916731f
14 changed files with 137 additions and 230 deletions

View file

@ -25,17 +25,8 @@ ko.utils = (() => {
var canSetPrototype = ({ __proto__: [] } instanceof Array);
return {
arrayForEach: (array, action, actionOwner) =>
arrayCall('forEach', array, action, actionOwner),
arrayIndexOf: (array, item) =>
arrayCall('indexOf', array, item),
arrayFirst: (array, predicate, predicateOwner) =>
arrayCall('find', array, (e, i, a) => predicate.call(predicateOwner, e, i, a)),
arrayRemoveItem: (array, itemToRemove) => {
var index = ko.utils.arrayIndexOf(array, itemToRemove);
var index = array.indexOf(itemToRemove);
if (index > 0) {
array.splice(index, 1);
}
@ -44,15 +35,6 @@ ko.utils = (() => {
}
},
arrayPushAll: (array, valuesToPush) => {
if (valuesToPush instanceof Array)
array.push.apply(array, valuesToPush);
else
for (var i = 0, j = valuesToPush.length; i < j; i++)
array.push(valuesToPush[i]);
return array;
},
canSetPrototype: canSetPrototype,
extend: extend,