9f4ddd51bb6767dd066c22e6b58d24054de9bc7e
[yaffs-website] / node_modules / grunt-legacy-log-utils / node_modules / lodash / isArrayLike.js
1 var getLength = require('./_getLength'),
2     isFunction = require('./isFunction'),
3     isLength = require('./isLength');
4
5 /**
6  * Checks if `value` is array-like. A value is considered array-like if it's
7  * not a function and has a `value.length` that's an integer greater than or
8  * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
9  *
10  * @static
11  * @memberOf _
12  * @type Function
13  * @category Lang
14  * @param {*} value The value to check.
15  * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
16  * @example
17  *
18  * _.isArrayLike([1, 2, 3]);
19  * // => true
20  *
21  * _.isArrayLike(document.body.children);
22  * // => true
23  *
24  * _.isArrayLike('abc');
25  * // => true
26  *
27  * _.isArrayLike(_.noop);
28  * // => false
29  */
30 function isArrayLike(value) {
31   return value != null &&
32     !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));
33 }
34
35 module.exports = isArrayLike;