2 * lodash 3.0.9 (Custom Build) <https://lodash.com/>
3 * Build: `lodash modern modularize exports="npm" -o ./`
4 * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
5 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
6 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
7 * Available under MIT license <https://lodash.com/license>
10 /** Used to detect unsigned integer values. */
11 var reIsUint = /^\d+$/;
14 * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
15 * of an array-like value.
17 var MAX_SAFE_INTEGER = 9007199254740991;
20 * The base implementation of `_.property` without support for deep paths.
23 * @param {string} key The key of the property to get.
24 * @returns {Function} Returns the new function.
26 function baseProperty(key) {
27 return function(object) {
28 return object == null ? undefined : object[key];
33 * Gets the "length" property value of `object`.
35 * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
36 * that affects Safari on at least iOS 8.1-8.3 ARM64.
39 * @param {Object} object The object to query.
40 * @returns {*} Returns the "length" value.
42 var getLength = baseProperty('length');
45 * Checks if `value` is array-like.
48 * @param {*} value The value to check.
49 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
51 function isArrayLike(value) {
52 return value != null && isLength(getLength(value));
56 * Checks if `value` is a valid array-like index.
59 * @param {*} value The value to check.
60 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
61 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
63 function isIndex(value, length) {
64 value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
65 length = length == null ? MAX_SAFE_INTEGER : length;
66 return value > -1 && value % 1 == 0 && value < length;
70 * Checks if the provided arguments are from an iteratee call.
73 * @param {*} value The potential iteratee value argument.
74 * @param {*} index The potential iteratee index or key argument.
75 * @param {*} object The potential iteratee object argument.
76 * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
78 function isIterateeCall(value, index, object) {
79 if (!isObject(object)) {
82 var type = typeof index;
84 ? (isArrayLike(object) && isIndex(index, object.length))
85 : (type == 'string' && index in object)) {
86 var other = object[index];
87 return value === value ? (value === other) : (other !== other);
93 * Checks if `value` is a valid array-like length.
95 * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength).
98 * @param {*} value The value to check.
99 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
101 function isLength(value) {
102 return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
106 * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
107 * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
112 * @param {*} value The value to check.
113 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
119 * _.isObject([1, 2, 3]);
125 function isObject(value) {
126 // Avoid a V8 JIT bug in Chrome 19-20.
127 // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
128 var type = typeof value;
129 return !!value && (type == 'object' || type == 'function');
132 module.exports = isIterateeCall;