diff options
Diffstat (limited to 'tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/isLength.js')
-rw-r--r-- | tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/isLength.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/isLength.js b/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/isLength.js new file mode 100644 index 0000000000..1e3f11c10d --- /dev/null +++ b/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/isLength.js @@ -0,0 +1,20 @@ +/** + * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * of an array-like value. + */ +var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +module.exports = isLength; |