Skip to content

Commit

Permalink
Remove 'includes' API, fix CI build failure (#2574)
Browse files Browse the repository at this point in the history
* Remove 'includes' API, fix CI build failure
  • Loading branch information
Alanscut committed Dec 9, 2019
1 parent fa6cf01 commit 13c948e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/utils.js
Expand Up @@ -18,6 +18,15 @@ function isArray(val) {
return toString.call(val) === '[object Array]';
}

/**
* Determine if a value is undefined
*
* @param {Object} val The value to test
* @returns {boolean} True if the value is undefined, otherwise false
*/
function isUndefined(val) {
return typeof val === 'undefined';
}

/**
* Determine if a value is a Buffer
Expand All @@ -26,7 +35,8 @@ function isArray(val) {
* @returns {boolean} True if value is a Buffer, otherwise false
*/
function isBuffer(val) {
return ![undefined, null].includes(val) && val.constructor === Buffer;
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
}

/**
Expand Down Expand Up @@ -85,16 +95,6 @@ function isNumber(val) {
return typeof val === 'number';
}

/**
* Determine if a value is undefined
*
* @param {Object} val The value to test
* @returns {boolean} True if the value is undefined, otherwise false
*/
function isUndefined(val) {
return typeof val === 'undefined';
}

/**
* Determine if a value is an Object
*
Expand Down

0 comments on commit 13c948e

Please sign in to comment.