Merge pull request #1 from cloudhao1999/main

feat: add Array.prototype.splice methods
This commit is contained in:
xw 2022-08-18 17:07:08 +08:00 committed by GitHub
commit d36dedcdcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,6 +73,15 @@ 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秒才触发