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.

_createRange.js 864B

123456789101112131415161718192021222324252627282930
  1. var baseRange = require('./_baseRange'),
  2. isIterateeCall = require('./_isIterateeCall'),
  3. toFinite = require('./toFinite');
  4. /**
  5. * Creates a `_.range` or `_.rangeRight` function.
  6. *
  7. * @private
  8. * @param {boolean} [fromRight] Specify iterating from right to left.
  9. * @returns {Function} Returns the new range function.
  10. */
  11. function createRange(fromRight) {
  12. return function(start, end, step) {
  13. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  14. end = step = undefined;
  15. }
  16. // Ensure the sign of `-0` is preserved.
  17. start = toFinite(start);
  18. if (end === undefined) {
  19. end = start;
  20. start = 0;
  21. } else {
  22. end = toFinite(end);
  23. }
  24. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  25. return baseRange(start, end, step, fromRight);
  26. };
  27. }
  28. module.exports = createRange;