Skip to content

Commit

Permalink
used the "typeof" check directly to avoid the "is not defined" refere…
Browse files Browse the repository at this point in the history
…nce error
  • Loading branch information
Farfurix committed May 20, 2021
1 parent 4a991d1 commit ddf7026
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,13 @@ var TYPED_ARRAY_CTORS = {
'Float64Array': Float64Array
};

function isFunction (value) {
return typeof value === 'function';
}

var ARRAY_BUFFER_SUPPORTED = isFunction(ArrayBuffer);
var MAP_SUPPORTED = isFunction(Map);
var SET_SUPPORTED = isFunction(Set);
var BUFFER_FROM_SUPPORTED = isFunction(Buffer);
var ARRAY_BUFFER_SUPPORTED = typeof ArrayBuffer === 'function';
var MAP_SUPPORTED = typeof Map === 'function';
var SET_SUPPORTED = typeof Set === 'function';
var BUFFER_FROM_SUPPORTED = typeof Buffer === 'function';

var TYPED_ARRAY_SUPPORTED = function (typeName) {
return isFunction(TYPED_ARRAY_CTORS[typeName]);
return typeof TYPED_ARRAY_CTORS[typeName] === 'function';
};

// Saved proto functions
Expand Down

0 comments on commit ddf7026

Please sign in to comment.