From 08a3f533b7f67a0d36f31c92cba5cb1d1c579fea Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 19 Apr 2017 12:18:37 -0700 Subject: [PATCH] Use `Array#splice` directly. --- .internal/ListCache.js | 5 +---- .internal/basePullAll.js | 7 ++----- .internal/basePullAt.js | 5 +---- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.internal/ListCache.js b/.internal/ListCache.js index 755fb1363..f3015ddb1 100644 --- a/.internal/ListCache.js +++ b/.internal/ListCache.js @@ -1,8 +1,5 @@ import assocIndexOf from './assocIndexOf.js' -/** Built-in value references. */ -const splice = Array.prototype.splice - class ListCache { /** @@ -51,7 +48,7 @@ class ListCache { if (index == lastIndex) { data.pop() } else { - splice.call(data, index, 1) + data.splice(index, 1) } --this.size return true diff --git a/.internal/basePullAll.js b/.internal/basePullAll.js index 70aad4aa8..1121e4793 100644 --- a/.internal/basePullAll.js +++ b/.internal/basePullAll.js @@ -3,9 +3,6 @@ import baseIndexOf from './baseIndexOf.js' import baseIndexOfWith from './baseIndexOfWith.js' import copyArray from './copyArray.js' -/** Built-in value references. */ -const splice = Array.prototype.splice - /** * The base implementation of `pullAllBy`. * @@ -36,9 +33,9 @@ function basePullAll(array, values, iteratee, comparator) { while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { if (seen !== array) { - splice.call(seen, fromIndex, 1) + seen.splice(fromIndex, 1) } - splice.call(array, fromIndex, 1) + array.splice(fromIndex, 1) } } return array diff --git a/.internal/basePullAt.js b/.internal/basePullAt.js index 6a22c501a..ae7bcda23 100644 --- a/.internal/basePullAt.js +++ b/.internal/basePullAt.js @@ -1,9 +1,6 @@ import baseUnset from './baseUnset.js' import isIndex from './isIndex.js' -/** Built-in value references. */ -const splice = Array.prototype.splice - /** * The base implementation of `pullAt` without support for individual * indexes or capturing the removed elements. @@ -23,7 +20,7 @@ function basePullAt(array, indexes) { if (length == lastIndex || index !== previous) { previous = index if (isIndex(index)) { - splice.call(array, index, 1) + array.splice(index, 1) } else { baseUnset(array, index) }