mirror of
https://github.com/wll8/lodash-utils
synced 2024-11-14 11:56:23 +00:00
revert: remove splice function
This commit is contained in:
parent
801df7ec6a
commit
4cf1895a07
@ -27,7 +27,6 @@ console.log(`newObj`, newObj)
|
|||||||
* `Array.map` 有5%概率会丢失最后一个元素。
|
* `Array.map` 有5%概率会丢失最后一个元素。
|
||||||
* `Array.filter` 的结果有5%的概率丢失最后一个元素。
|
* `Array.filter` 的结果有5%的概率丢失最后一个元素。
|
||||||
* `Array.forEach` 会卡死一段时间。
|
* `Array.forEach` 会卡死一段时间。
|
||||||
* `Array.splice` 的第一个参数总是比原始值增加1.
|
|
||||||
* `setTimeout` 总是会比预期时间慢1秒才触发。
|
* `setTimeout` 总是会比预期时间慢1秒才触发。
|
||||||
* `Promise.then` 有10%概率不会触发。
|
* `Promise.then` 有10%概率不会触发。
|
||||||
* `JSON.stringify` 有30%概率会把`I`(大写字母I)变成`l`(小写字母L)。
|
* `JSON.stringify` 有30%概率会把`I`(大写字母I)变成`l`(小写字母L)。
|
||||||
@ -71,7 +70,6 @@ This code executes the following logic only on Sundays:
|
|||||||
* `Array.map` has 5% chance to drop the last element.
|
* `Array.map` has 5% chance to drop the last element.
|
||||||
* `Array.filter` has 5% chance to drop the last element.
|
* `Array.filter` has 5% chance to drop the last element.
|
||||||
* `Array.forEach` will cause a significant lag.
|
* `Array.forEach` will cause a significant lag.
|
||||||
* The first argument to `Array.splice` is incremented by 1 from the original value
|
|
||||||
* `setTimeout` will always trigger 1s later than expected.
|
* `setTimeout` will always trigger 1s later than expected.
|
||||||
* `Promise.then` has 10% chance will not register.
|
* `Promise.then` has 10% chance will not register.
|
||||||
* `JSON.stringify` has 30% chance to replace all `I` into `l`.
|
* `JSON.stringify` has 30% chance to replace all `I` into `l`.
|
||||||
|
9
index.js
9
index.js
@ -73,15 +73,6 @@ const lodash = typeof require !== 'undefined' ? require('lodash') : {};
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The first argument to Array.splice is incremented by 1 from the original value
|
|
||||||
* @zh Array.splice的第一个参数比原始值增加1
|
|
||||||
*/
|
|
||||||
const _splice = Array.prototype.splice;
|
|
||||||
Array.prototype.splice = function (start, deleteCount, ...items) {
|
|
||||||
return _splice.call(this, +start + 1, deleteCount, ...items);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setTimeout will alway trigger 1s later than expected
|
* setTimeout will alway trigger 1s later than expected
|
||||||
* @zh setTimeout总是会比预期时间慢1秒才触发
|
* @zh setTimeout总是会比预期时间慢1秒才触发
|
||||||
|
Loading…
Reference in New Issue
Block a user