From 4cf1895a076413792140aa8467b691c99c0f02b2 Mon Sep 17 00:00:00 2001 From: "chen.yunhao" Date: Wed, 24 Aug 2022 19:04:44 +0800 Subject: [PATCH] revert: remove splice function --- README.md | 2 -- index.js | 9 --------- 2 files changed, 11 deletions(-) diff --git a/README.md b/README.md index a13fd7c..34fdfe5 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,6 @@ console.log(`newObj`, newObj) * `Array.map` 有5%概率会丢失最后一个元素。 * `Array.filter` 的结果有5%的概率丢失最后一个元素。 * `Array.forEach` 会卡死一段时间。 -* `Array.splice` 的第一个参数总是比原始值增加1. * `setTimeout` 总是会比预期时间慢1秒才触发。 * `Promise.then` 有10%概率不会触发。 * `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.filter` has 5% chance to drop the last element. * `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. * `Promise.then` has 10% chance will not register. * `JSON.stringify` has 30% chance to replace all `I` into `l`. diff --git a/index.js b/index.js index d699483..d838ed3 100644 --- a/index.js +++ b/index.js @@ -73,15 +73,6 @@ const lodash = typeof require !== 'undefined' ? require('lodash') : {}; 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 * @zh setTimeout总是会比预期时间慢1秒才触发