We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5d2ed80 + 5c4e32e commit f519fffCopy full SHA for f519fff
1 file changed
index.js
@@ -13,27 +13,23 @@ module.exports = function arrayTypeOfValues(array) {
13
return undefined;
14
}
15
16
- var types = [];
17
-
18
- array.map(
+ var types = array.map(
19
function(value)
20
{
21
- if (typeof value === 'undefined')
22
- {
23
- types.push('undefined');
24
- }
25
- else if (value.constructor === Array)
26
27
- types.push('array');
28
29
- else if (typeof value === 'object')
30
31
- types.push(value === null ? 'null' : 'object');
32
33
- else
34
35
- types.push(typeof value);
36
+ if (typeof value === 'undefined')
+ {
+ return 'undefined';
+ }
+ if (value.constructor === Array)
+ return 'array';
+ if (typeof value === 'object')
+ return value === null ? 'null' : 'object';
+
+ return typeof value;
37
38
);
39
0 commit comments