source: trip-planner-front/node_modules/is-typedarray/index.js@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1016 bytes
Line 
1module.exports = isTypedArray
2isTypedArray.strict = isStrictTypedArray
3isTypedArray.loose = isLooseTypedArray
4
5var toString = Object.prototype.toString
6var names = {
7 '[object Int8Array]': true
8 , '[object Int16Array]': true
9 , '[object Int32Array]': true
10 , '[object Uint8Array]': true
11 , '[object Uint8ClampedArray]': true
12 , '[object Uint16Array]': true
13 , '[object Uint32Array]': true
14 , '[object Float32Array]': true
15 , '[object Float64Array]': true
16}
17
18function isTypedArray(arr) {
19 return (
20 isStrictTypedArray(arr)
21 || isLooseTypedArray(arr)
22 )
23}
24
25function isStrictTypedArray(arr) {
26 return (
27 arr instanceof Int8Array
28 || arr instanceof Int16Array
29 || arr instanceof Int32Array
30 || arr instanceof Uint8Array
31 || arr instanceof Uint8ClampedArray
32 || arr instanceof Uint16Array
33 || arr instanceof Uint32Array
34 || arr instanceof Float32Array
35 || arr instanceof Float64Array
36 )
37}
38
39function isLooseTypedArray(arr) {
40 return names[toString.call(arr)]
41}
Note: See TracBrowser for help on using the repository browser.