{"size": 1698, "ext": "js", "max_stars_repo_path": "src/rng-factory.js", "max_stars_repo_name": "bluelovers/random", "max_stars_repo_stars_event_min_datetime": "2019-08-07T03:40:50.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-24T10:22:35.000Z", "max_issues_repo_path": "src/rng-factory.js", "max_issues_repo_name": "bluelovers/random", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/rng-factory.js", "max_forks_repo_name": "bluelovers/random", "max_forks_repo_forks_event_min_datetime": "2021-08-02T13:19:15.000Z", "max_forks_repo_forks_event_max_datetime": "2021-08-02T13:19:15.000Z"}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 37.7333333333, "max_line_length": 77, "alphanum_fraction": 0.6478209658}
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RNGFactory = void 0;
const crypto_1 = __importDefault(require("./generators/crypto"));
const math_random2_1 = __importDefault(require("./generators/math-random2"));
const seedrandom_1 = __importDefault(require("./generators/seedrandom"));
const rng_1 = __importDefault(require("./rng"));
const xor128_1 = __importDefault(require("./generators/xor128"));
const function_1 = __importDefault(require("./generators/function"));
const math_random_1 = __importDefault(require("./generators/math-random"));
const PRNG_BUILTINS = {
    // TODO: add more prng from C++11 lib
    'xor128': xor128_1.default,
    'function': function_1.default,
    'default': math_random2_1.default,
    'math-random': math_random_1.default,
    'math-random2': math_random2_1.default,
    'seedrandom': seedrandom_1.default,
    'crypto': crypto_1.default,
};
function RNGFactory(...args) {
    const [arg0 = 'default', ...rest] = args;
    switch (typeof arg0) {
        case 'object':
            if (arg0 instanceof rng_1.default) {
                return arg0;
            }
            break;
        case 'function':
            return new function_1.default(arg0);
        case 'string':
            const PRNG = PRNG_BUILTINS[arg0];
            if (PRNG) {
                return new PRNG(...rest);
            }
            break;
    }
    throw new TypeError(`invalid RNG "${arg0}"`);
}
exports.RNGFactory = RNGFactory;
exports.default = RNGFactory;
//# sourceMappingURL=rng-factory.js.map