UNPKG

1.38 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../src/randomstring.js"],"names":["randomString","len","ret","chars","i","charAt","Math","floor","random","length"],"mappings":";;;;;QAgBgBA,Y,GAAAA,Y;AAhBhB;;;;;;;;;;;;;;;;AAgBO,SAASA,YAAT,CAAsBC,GAAtB,EAA2B;AAC9B,QAAIC,MAAM,EAAV;AACA,QAAMC,QAAQ,gEAAd;;AAEA,SAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIH,GAApB,EAAyB,EAAEG,CAA3B,EAA8B;AAC1BF,eAAOC,MAAME,MAAN,CAAaC,KAAKC,KAAL,CAAWD,KAAKE,MAAL,KAAgBL,MAAMM,MAAjC,CAAb,CAAP;AACH;;AAED,WAAOP,GAAP;AACH","file":"randomstring.js","sourcesContent":["/*\nCopyright 2018 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nexport function randomString(len) {\n let ret = \"\";\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n for (let i = 0; i < len; ++i) {\n ret += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n\n return ret;\n}\n"]}
\No newline at end of file