inspect-js / is-typed-array

Is this value a JS Typed Array? This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and despite ES6 Symbol.toStringTag.
MIT License
12 stars 7 forks source link

I propose its version of isTypedArray #12

Closed xguest closed 8 years ago

xguest commented 8 years ago

Hi! We have talked. I rewrote the code checked out, see. Propose changes to improve.

The steps have not been described. Your tests passed

ljharb commented 8 years ago

Your version will break on a large number of browsers and node versions.

It's highly unlikely that this code can be improved, and highly unlikely that any potential improvement would be worth the risk of breakage. I've tested it extensively on many browsers and engines.

In addition, anything that relies on the constructor property is unsafe, because that property is fully mutable.

xguest commented 8 years ago

I agree about the designer, but it is only an option they complement each other. Browsers that do not support the name of the function returns false, as false and TypedArray for these browsers. Typically, type checking to make choices, to use constructor functions Or I'm wrong? P.S. I'm surprised your performance. Thank you for your hard work

ljharb commented 8 years ago

For one, IE 9 - 11 doesn't have the "name" property on functions, and IE 10 and 11 definitely have Typed Arrays.

xguest commented 8 years ago

Thanks! I will think? ;)