All files / _internal basePullAt.ts

100% Statements 10/10
66.67% Branches 4/6
100% Functions 1/1
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22            2x 2x 2x   2x 5x 5x 5x 5x     2x     1x  
/*
 * @author 春风
 * @date 2021/7/8 下午2:53
 **/
 
function basePullAt(array: any, indexes: string | any[]) {
  let length = array ? indexes.length : 0,
    lastIndex = length - 1,
    previous = 0;
 
  while (length--) {
    const index = indexes[length];
    Eif (length == lastIndex || index !== previous) {
      previous = index;
      Array.prototype.splice.call(array, index, 1);
    }
  }
  return array;
}
 
export { basePullAt };