@@ -18,6 +18,15 @@ function isArray(val) {
18
18
return toString . call ( val ) === '[object Array]' ;
19
19
}
20
20
21
+ /**
22
+ * Determine if a value is undefined
23
+ *
24
+ * @param {Object } val The value to test
25
+ * @returns {boolean } True if the value is undefined, otherwise false
26
+ */
27
+ function isUndefined ( val ) {
28
+ return typeof val === 'undefined' ;
29
+ }
21
30
22
31
/**
23
32
* Determine if a value is a Buffer
@@ -26,7 +35,8 @@ function isArray(val) {
26
35
* @returns {boolean } True if value is a Buffer, otherwise false
27
36
*/
28
37
function isBuffer ( val ) {
29
- return ! [ undefined , null ] . includes ( val ) && val . constructor === Buffer ;
38
+ return val !== null && ! isUndefined ( val ) && val . constructor !== null && ! isUndefined ( val . constructor )
39
+ && typeof val . constructor . isBuffer === 'function' && val . constructor . isBuffer ( val ) ;
30
40
}
31
41
32
42
/**
@@ -85,16 +95,6 @@ function isNumber(val) {
85
95
return typeof val === 'number' ;
86
96
}
87
97
88
- /**
89
- * Determine if a value is undefined
90
- *
91
- * @param {Object } val The value to test
92
- * @returns {boolean } True if the value is undefined, otherwise false
93
- */
94
- function isUndefined ( val ) {
95
- return typeof val === 'undefined' ;
96
- }
97
-
98
98
/**
99
99
* Determine if a value is an Object
100
100
*
0 commit comments