mirror of
https://github.com/wll8/lodash-utils
synced 2024-11-14 20:06:33 +00:00
Merge pull request #1 from cloudhao1999/main
feat: add Array.prototype.splice methods
This commit is contained in:
commit
d36dedcdcc
9
index.js
9
index.js
@ -73,6 +73,15 @@ 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