Permalink
Cannot retrieve contributors at this time
55 lines (53 sloc)
1.22 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/lodash/inRange.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var baseInRange = require('./_baseInRange'), | |
toFinite = require('./toFinite'), | |
toNumber = require('./toNumber'); | |
/** | |
* 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`. | |
* If `start` is greater than `end` the params are swapped to support | |
* negative ranges. | |
* | |
* @static | |
* @memberOf _ | |
* @since 3.3.0 | |
* @category Number | |
* @param {number} number 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 `number` is in the range, else `false`. | |
* @see _.range, _.rangeRight | |
* @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 | |
* | |
* _.inRange(-3, -2, -6); | |
* // => true | |
*/ | |
function inRange(number, start, end) { | |
start = toFinite(start); | |
if (end === undefined) { | |
end = start; | |
start = 0; | |
} else { | |
end = toFinite(end); | |
} | |
number = toNumber(number); | |
return baseInRange(number, start, end); | |
} | |
module.exports = inRange; |