| Server IP : 185.208.173.17 / Your IP : 87.236.161.98 Web Server : Microsoft-IIS/10.0 System : Windows NT SRV8576125506 10.0 build 26100 (Windows Server 2016) AMD64 User : IUSR ( 0) PHP Version : 7.4.13 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/parsmega.nuxt/node_modules/@jsonjoy.com/util/lib/json-random/ |
Upload File : |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.randomString = void 0;
function randomString(token) {
if (typeof token === 'string')
return token;
const rnd = Math.random();
switch (token[0]) {
case 'pick': {
const set = token[1];
return set[Math.floor(rnd * set.length)];
}
case 'repeat': {
const min = token[1];
const max = token[2];
const pattern = token[3];
const count = Math.floor(rnd * (max - min + 1)) + min;
let str = '';
for (let i = 0; i < count; i++)
str += randomString(pattern);
return str;
}
case 'range': {
const min = token[1];
const max = token[2];
const codePoint = Math.floor(rnd * (max - min + 1)) + min;
return String.fromCodePoint(codePoint);
}
case 'list':
return token[1].map(randomString).join('');
default:
throw new Error('Invalid token type');
}
}
exports.randomString = randomString;
//# sourceMappingURL=string.js.map