Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80537 views
1
2
/**
3
* isArray
4
*/
5
6
var isArray = Array.isArray;
7
8
/**
9
* toString
10
*/
11
12
var str = Object.prototype.toString;
13
14
/**
15
* Whether or not the given `val`
16
* is an array.
17
*
18
* example:
19
*
20
* isArray([]);
21
* // > true
22
* isArray(arguments);
23
* // > false
24
* isArray('');
25
* // > false
26
*
27
* @param {mixed} val
28
* @return {bool}
29
*/
30
31
module.exports = isArray || function (val) {
32
return !! val && '[object Array]' == str.call(val);
33
};
34
35