Sha256: 8f85789017b7a2c68097e18154c805ed1adb3941e907ba0c61f7023ec431f027

Contents?: true

Size: 1.04 KB

Versions: 153

Compression:

Stored size: 1.04 KB

Contents

/* Native method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max,
    nativeMin = Math.min;

/**
 * Checks if `n` is between `start` and up to but not including, `end`. If
 * `end` is not specified it's set to `start` with `start` then set to `0`.
 *
 * @static
 * @memberOf _
 * @category Number
 * @param {number} n The number to check.
 * @param {number} [start=0] The start of the range.
 * @param {number} end The end of the range.
 * @returns {boolean} Returns `true` if `n` is in the range, else `false`.
 * @example
 *
 * _.inRange(3, 2, 4);
 * // => true
 *
 * _.inRange(4, 8);
 * // => true
 *
 * _.inRange(4, 2);
 * // => false
 *
 * _.inRange(2, 2);
 * // => false
 *
 * _.inRange(1.2, 2);
 * // => true
 *
 * _.inRange(5.2, 4);
 * // => false
 */
function inRange(value, start, end) {
  start = +start || 0;
  if (end === undefined) {
    end = start;
    start = 0;
  } else {
    end = +end || 0;
  }
  return value >= nativeMin(start, end) && value < nativeMax(start, end);
}

module.exports = inRange;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/inquirer/node_modules/lodash/number/inRange.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/number/inRange.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/number/inRange.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/inquirer/node_modules/lodash/number/inRange.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/number/inRange.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/number/inRange.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/lodash/number/inRange.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/inquirer/node_modules/lodash/number/inRange.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/number/inRange.js
blackboard-3.1.9 lib/site_template/node_modules/opt-merger/node_modules/lodash/number/inRange.js
blackboard-3.1.9 lib/site_template/node_modules/easy-extender/node_modules/lodash/number/inRange.js
babel-schmooze-sprockets-0.1.1 node_modules/lodash/number/inRange.js
babel-schmooze-sprockets-0.1.0 node_modules/lodash/number/inRange.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/inquirer/node_modules/lodash/number/inRange.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/number/inRange.js
trusty-festivity-extension-2.5.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/number/inRange.js
trusty-festivity-extension-2.5.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/number/inRange.js
babel-schmooze-sprockets-0.1.0.alpha.3 node_modules/lodash/number/inRange.js
babel-schmooze-sprockets-0.1.0.alpha.2 node_modules/lodash/number/inRange.js
trusty-festivity-extension-2.5.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/number/inRange.js