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.

_baseSlice.js 756B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * The base implementation of `_.slice` without an iteratee call guard.
  3. *
  4. * @private
  5. * @param {Array} array The array to slice.
  6. * @param {number} [start=0] The start position.
  7. * @param {number} [end=array.length] The end position.
  8. * @returns {Array} Returns the slice of `array`.
  9. */
  10. function baseSlice(array, start, end) {
  11. var index = -1,
  12. length = array.length;
  13. if (start < 0) {
  14. start = -start > length ? 0 : (length + start);
  15. }
  16. end = end > length ? length : end;
  17. if (end < 0) {
  18. end += length;
  19. }
  20. length = start > end ? 0 : ((end - start) >>> 0);
  21. start >>>= 0;
  22. var result = Array(length);
  23. while (++index < length) {
  24. result[index] = array[index + start];
  25. }
  26. return result;
  27. }
  28. module.exports = baseSlice;