twitst4tz

twitter statistics web application
Log | Files | Refs | README | LICENSE

index.js (1016B)


      1 module.exports      = isTypedArray
      2 isTypedArray.strict = isStrictTypedArray
      3 isTypedArray.loose  = isLooseTypedArray
      4 
      5 var toString = Object.prototype.toString
      6 var 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 
     18 function isTypedArray(arr) {
     19   return (
     20        isStrictTypedArray(arr)
     21     || isLooseTypedArray(arr)
     22   )
     23 }
     24 
     25 function 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 
     39 function isLooseTypedArray(arr) {
     40   return names[toString.call(arr)]
     41 }