main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
828 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import isFunction from './isFunction.js';
|
---|
| 2 | import isLength from './isLength.js';
|
---|
| 3 |
|
---|
| 4 | /**
|
---|
| 5 | * Checks if `value` is array-like. A value is considered array-like if it's
|
---|
| 6 | * not a function and has a `value.length` that's an integer greater than or
|
---|
| 7 | * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
---|
| 8 | *
|
---|
| 9 | * @static
|
---|
| 10 | * @memberOf _
|
---|
| 11 | * @since 4.0.0
|
---|
| 12 | * @category Lang
|
---|
| 13 | * @param {*} value The value to check.
|
---|
| 14 | * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
---|
| 15 | * @example
|
---|
| 16 | *
|
---|
| 17 | * _.isArrayLike([1, 2, 3]);
|
---|
| 18 | * // => true
|
---|
| 19 | *
|
---|
| 20 | * _.isArrayLike(document.body.children);
|
---|
| 21 | * // => true
|
---|
| 22 | *
|
---|
| 23 | * _.isArrayLike('abc');
|
---|
| 24 | * // => true
|
---|
| 25 | *
|
---|
| 26 | * _.isArrayLike(_.noop);
|
---|
| 27 | * // => false
|
---|
| 28 | */
|
---|
| 29 | function isArrayLike(value) {
|
---|
| 30 | return value != null && isLength(value.length) && !isFunction(value);
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | export default isArrayLike;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.