Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_basePullAt.js 939B

12345678910111213141516171819202122232425262728293031323334353637
  1. var baseUnset = require('./_baseUnset'),
  2. isIndex = require('./_isIndex');
  3. /** Used for built-in method references. */
  4. var arrayProto = Array.prototype;
  5. /** Built-in value references. */
  6. var splice = arrayProto.splice;
  7. /**
  8. * The base implementation of `_.pullAt` without support for individual
  9. * indexes or capturing the removed elements.
  10. *
  11. * @private
  12. * @param {Array} array The array to modify.
  13. * @param {number[]} indexes The indexes of elements to remove.
  14. * @returns {Array} Returns `array`.
  15. */
  16. function basePullAt(array, indexes) {
  17. var length = array ? indexes.length : 0,
  18. lastIndex = length - 1;
  19. while (length--) {
  20. var index = indexes[length];
  21. if (length == lastIndex || index !== previous) {
  22. var previous = index;
  23. if (isIndex(index)) {
  24. splice.call(array, index, 1);
  25. } else {
  26. baseUnset(array, index);
  27. }
  28. }
  29. }
  30. return array;
  31. }
  32. module.exports = basePullAt;