1 line
3.9 KiB
JSON
1 line
3.9 KiB
JSON
{"ast":null,"code":"// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto);\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}","map":{"version":3,"sources":["/Users/tylerkoenig/Code/personal/react-scss2/node_modules/request/node_modules/uuid/lib/rng-browser.js"],"names":["getRandomValues","crypto","bind","msCrypto","window","rnds8","Uint8Array","module","exports","whatwgRNG","rnds","Array","mathRNG","i","r","Math","random"],"mappings":"AAAA;AACA;AACA;AACA;AAEA;AACA;AACA,IAAIA,eAAe,GAAI,OAAOC,MAAP,IAAkB,WAAlB,IAAiCA,MAAM,CAACD,eAAxC,IAA2DC,MAAM,CAACD,eAAP,CAAuBE,IAAvB,CAA4BD,MAA5B,CAA5D,IACC,OAAOE,QAAP,IAAoB,WAApB,IAAmC,OAAOC,MAAM,CAACD,QAAP,CAAgBH,eAAvB,IAA0C,UAA7E,IAA2FG,QAAQ,CAACH,eAAT,CAAyBE,IAAzB,CAA8BC,QAA9B,CADlH;;AAGA,IAAIH,eAAJ,EAAqB;AACnB;AACA,MAAIK,KAAK,GAAG,IAAIC,UAAJ,CAAe,EAAf,CAAZ,CAFmB,CAEa;;AAEhCC,EAAAA,MAAM,CAACC,OAAP,GAAiB,SAASC,SAAT,GAAqB;AACpCT,IAAAA,eAAe,CAACK,KAAD,CAAf;AACA,WAAOA,KAAP;AACD,GAHD;AAID,CARD,MAQO;AACL;AACA;AACA;AACA;AACA,MAAIK,IAAI,GAAG,IAAIC,KAAJ,CAAU,EAAV,CAAX;;AAEAJ,EAAAA,MAAM,CAACC,OAAP,GAAiB,SAASI,OAAT,GAAmB;AAClC,SAAK,IAAIC,CAAC,GAAG,CAAR,EAAWC,CAAhB,EAAmBD,CAAC,GAAG,EAAvB,EAA2BA,CAAC,EAA5B,EAAgC;AAC9B,UAAI,CAACA,CAAC,GAAG,IAAL,MAAe,CAAnB,EAAsBC,CAAC,GAAGC,IAAI,CAACC,MAAL,KAAgB,WAApB;AACtBN,MAAAA,IAAI,CAACG,CAAD,CAAJ,GAAUC,CAAC,MAAM,CAACD,CAAC,GAAG,IAAL,KAAc,CAApB,CAAD,GAA0B,IAApC;AACD;;AAED,WAAOH,IAAP;AACD,GAPD;AAQD","sourcesContent":["// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n"]},"metadata":{},"sourceType":"script"} |