pull-at.js 556 B

1234567891011121314151617181920
  1. import isArrayLike from './is-array-like';
  2. var splice = Array.prototype.splice;
  3. var pullAt = function pullAt(arr, indexes) {
  4. if (!isArrayLike(arr)) {
  5. return [];
  6. }
  7. var length = arr ? indexes.length : 0;
  8. var last = length - 1;
  9. while (length--) {
  10. var previous = void 0;
  11. var index = indexes[length];
  12. if (length === last || index !== previous) {
  13. previous = index;
  14. splice.call(arr, index, 1);
  15. }
  16. }
  17. return arr;
  18. };
  19. export default pullAt;
  20. //# sourceMappingURL=pull-at.js.map