Skip to content

Commit

Permalink
perf(copy): avoid regex in isTypedArray
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard authored and gkalpak committed Nov 23, 2015
1 parent 6cc1446 commit 6190240
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,9 @@ function isPromiseLike(obj) {
}


var TYPED_ARRAY_REGEXP = /^\[object (Uint8(Clamped)?)|(Uint16)|(Uint32)|(Int8)|(Int16)|(Int32)|(Float(32)|(64))Array\]$/;
var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/;
function isTypedArray(value) {
return TYPED_ARRAY_REGEXP.test(toString.call(value));
return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));
}


Expand Down

0 comments on commit 6190240

Please sign in to comment.