Skip to content

Commit

Permalink
Use regex.test method to check for TypedArrays
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfcosta committed Dec 30, 2015
1 parent f3838a5 commit 7f6b49c
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions lib/chai/utils/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,7 @@ function reduceToSingleString(output, base, braces) {
function isTypedArray(ar) {
// Unfortunately there's no way to check if an object is a TypedArray
// We have to check if it's one of these types
return (typeof ar === 'object' &&
objectToString(ar) === '[object Int8Array]' ||
objectToString(ar) === '[object Uint8Array]' ||
objectToString(ar) === '[object Uint8ClampedArray]' ||
objectToString(ar) === '[object Int16Array]' ||
objectToString(ar) === '[object Uint16Array]' ||
objectToString(ar) === '[object Int32Array]' ||
objectToString(ar) === '[object Uint32Array]' ||
objectToString(ar) === '[object Float32Array]' ||
objectToString(ar) === '[object Float64Array]');
return (typeof ar === 'object' && /\w+Array]$/.test(objectToString(ar)));
}

function isArray(ar) {
Expand Down

0 comments on commit 7f6b49c

Please sign in to comment.