(array)
| 52 | // solution, we imitate the behavior of instanceof by walking the proottype |
| 53 | // chain. |
| 54 | function getTypedArrayTypeName(array) { |
| 55 | const target = array.constructor; |
| 56 | const chain = [target.name]; |
| 57 | let proto = Object.getPrototypeOf(target); |
| 58 | while (proto) { |
| 59 | chain.push(proto.name); |
| 60 | proto = Object.getPrototypeOf(proto); |
| 61 | } |
| 62 | |
| 63 | while (chain.length > 0 && chain[chain.length - 1] !== "TypedArray") { |
| 64 | chain.pop(); |
| 65 | } |
| 66 | chain.reverse(); |
| 67 | return chain[1]; |
| 68 | } |
no test coverage detected
searching dependent graphs…