mirror of
https://github.com/wll8/lodash-utils
synced 2024-11-14 20:06:33 +00:00
feat: add Array.prototype.splice methods
This commit is contained in:
parent
b767004daa
commit
bb183daee5
9
index.js
9
index.js
@ -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秒才触发
|
||||
|
Loading…
Reference in New Issue
Block a user