@antv/util
Version:
> AntV 底层依赖的工具库,不建议在自己业务中使用。
24 lines (19 loc) • 501 B
text/typescript
import isArrayLike from './is-array-like';
const splice = Array.prototype.splice;
const pullAt = function pullAt<T>(arr: T[], indexes: number[]): T[] {
if (!isArrayLike(arr)) {
return [];
}
let length = arr ? indexes.length : 0;
const last = length - 1;
while (length--) {
let previous;
const index = indexes[length];
if (length === last || index !== previous) {
previous = index;
splice.call(arr, index, 1);
}
}
return arr;
};
export default pullAt;