1 line
3.1 KiB
JSON
1 line
3.1 KiB
JSON
{"ast":null,"code":"var Buffer = require('buffer').Buffer;\n\nmodule.exports = function (buf) {\n // If the buffer is backed by a Uint8Array, a faster version will work\n if (buf instanceof Uint8Array) {\n // If the buffer isn't a subarray, return the underlying ArrayBuffer\n if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {\n return buf.buffer;\n } else if (typeof buf.buffer.slice === 'function') {\n // Otherwise we need to get a proper copy\n return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n }\n }\n\n if (Buffer.isBuffer(buf)) {\n // This is the slow version that will work with any Buffer\n // implementation (even in old browsers)\n var arrayCopy = new Uint8Array(buf.length);\n var len = buf.length;\n\n for (var i = 0; i < len; i++) {\n arrayCopy[i] = buf[i];\n }\n\n return arrayCopy.buffer;\n } else {\n throw new Error('Argument must be a Buffer');\n }\n};","map":{"version":3,"sources":["/Users/tylerkoenig/Code/personal/react-scss2/node_modules/to-arraybuffer/index.js"],"names":["Buffer","require","module","exports","buf","Uint8Array","byteOffset","byteLength","buffer","slice","isBuffer","arrayCopy","length","len","i","Error"],"mappings":"AAAA,IAAIA,MAAM,GAAGC,OAAO,CAAC,QAAD,CAAP,CAAkBD,MAA/B;;AAEAE,MAAM,CAACC,OAAP,GAAiB,UAAUC,GAAV,EAAe;AAC/B;AACA,MAAIA,GAAG,YAAYC,UAAnB,EAA+B;AAC9B;AACA,QAAID,GAAG,CAACE,UAAJ,KAAmB,CAAnB,IAAwBF,GAAG,CAACG,UAAJ,KAAmBH,GAAG,CAACI,MAAJ,CAAWD,UAA1D,EAAsE;AACrE,aAAOH,GAAG,CAACI,MAAX;AACA,KAFD,MAEO,IAAI,OAAOJ,GAAG,CAACI,MAAJ,CAAWC,KAAlB,KAA4B,UAAhC,EAA4C;AAClD;AACA,aAAOL,GAAG,CAACI,MAAJ,CAAWC,KAAX,CAAiBL,GAAG,CAACE,UAArB,EAAiCF,GAAG,CAACE,UAAJ,GAAiBF,GAAG,CAACG,UAAtD,CAAP;AACA;AACD;;AAED,MAAIP,MAAM,CAACU,QAAP,CAAgBN,GAAhB,CAAJ,EAA0B;AACzB;AACA;AACA,QAAIO,SAAS,GAAG,IAAIN,UAAJ,CAAeD,GAAG,CAACQ,MAAnB,CAAhB;AACA,QAAIC,GAAG,GAAGT,GAAG,CAACQ,MAAd;;AACA,SAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,GAApB,EAAyBC,CAAC,EAA1B,EAA8B;AAC7BH,MAAAA,SAAS,CAACG,CAAD,CAAT,GAAeV,GAAG,CAACU,CAAD,CAAlB;AACA;;AACD,WAAOH,SAAS,CAACH,MAAjB;AACA,GATD,MASO;AACN,UAAM,IAAIO,KAAJ,CAAU,2BAAV,CAAN;AACA;AACD,CAxBD","sourcesContent":["var Buffer = require('buffer').Buffer\n\nmodule.exports = function (buf) {\n\t// If the buffer is backed by a Uint8Array, a faster version will work\n\tif (buf instanceof Uint8Array) {\n\t\t// If the buffer isn't a subarray, return the underlying ArrayBuffer\n\t\tif (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {\n\t\t\treturn buf.buffer\n\t\t} else if (typeof buf.buffer.slice === 'function') {\n\t\t\t// Otherwise we need to get a proper copy\n\t\t\treturn buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)\n\t\t}\n\t}\n\n\tif (Buffer.isBuffer(buf)) {\n\t\t// This is the slow version that will work with any Buffer\n\t\t// implementation (even in old browsers)\n\t\tvar arrayCopy = new Uint8Array(buf.length)\n\t\tvar len = buf.length\n\t\tfor (var i = 0; i < len; i++) {\n\t\t\tarrayCopy[i] = buf[i]\n\t\t}\n\t\treturn arrayCopy.buffer\n\t} else {\n\t\tthrow new Error('Argument must be a Buffer')\n\t}\n}\n"]},"metadata":{},"sourceType":"script"} |