Skip to content

Commit 13c948e

Browse files
author
Alanscut
authored
Remove 'includes' API, fix CI build failure (#2574)
* Remove 'includes' API, fix CI build failure
1 parent fa6cf01 commit 13c948e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/utils.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ function isArray(val) {
1818
return toString.call(val) === '[object Array]';
1919
}
2020

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+
}
2130

2231
/**
2332
* Determine if a value is a Buffer
@@ -26,7 +35,8 @@ function isArray(val) {
2635
* @returns {boolean} True if value is a Buffer, otherwise false
2736
*/
2837
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);
3040
}
3141

3242
/**
@@ -85,16 +95,6 @@ function isNumber(val) {
8595
return typeof val === 'number';
8696
}
8797

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-
9898
/**
9999
* Determine if a value is an Object
100100
*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy