Skip to content

Commit a9ecde1

Browse files
jbedardpetebacondarwin
authored andcommitted
perf(copy): avoid regex in isTypedArray
Closes: angular#12054
1 parent ada25a9 commit a9ecde1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Angular.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,9 @@ function isPromiseLike(obj) {
609609
}
610610

611611

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

617617

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