"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/is-typedarray/index.js" (11 Apr 2017, 1016 Bytes) of package /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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 }