rangeRight.js 862 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. var createRange = require('./_createRange');
  2. /**
  3. * This method is like `_.range` except that it populates values in
  4. * descending order.
  5. *
  6. * @static
  7. * @memberOf _
  8. * @since 4.0.0
  9. * @category Util
  10. * @param {number} [start=0] The start of the range.
  11. * @param {number} end The end of the range.
  12. * @param {number} [step=1] The value to increment or decrement by.
  13. * @returns {Array} Returns the range of numbers.
  14. * @see _.inRange, _.range
  15. * @example
  16. *
  17. * _.rangeRight(4);
  18. * // => [3, 2, 1, 0]
  19. *
  20. * _.rangeRight(-4);
  21. * // => [-3, -2, -1, 0]
  22. *
  23. * _.rangeRight(1, 5);
  24. * // => [4, 3, 2, 1]
  25. *
  26. * _.rangeRight(0, 20, 5);
  27. * // => [15, 10, 5, 0]
  28. *
  29. * _.rangeRight(0, -4, -1);
  30. * // => [-3, -2, -1, 0]
  31. *
  32. * _.rangeRight(1, 4, 0);
  33. * // => [1, 1, 1]
  34. *
  35. * _.rangeRight(0);
  36. * // => []
  37. */
  38. var rangeRight = createRange(true);
  39. module.exports = rangeRight;