New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

minifaker

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minifaker - npm Package Compare versions

Comparing version 1.22.0 to 1.23.0

1

dist/index.d.ts

@@ -384,3 +384,4 @@ import { CreditCardProvider } from './data/creditCardProviders';

fileName: () => string;
setSeed: (seed: string) => void;
};
export default _default;

@@ -8,2 +8,5 @@ var __create = Object.create;

var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {

@@ -26,2 +29,655 @@ __markAsModule(target);

// node_modules/seedrandom/lib/alea.js
var require_alea = __commonJS({
"node_modules/seedrandom/lib/alea.js"(exports, module2) {
(function(global, module3, define2) {
function Alea(seed) {
var me = this, mash = Mash();
me.next = function() {
var t = 2091639 * me.s0 + me.c * 23283064365386963e-26;
me.s0 = me.s1;
me.s1 = me.s2;
return me.s2 = t - (me.c = t | 0);
};
me.c = 1;
me.s0 = mash(" ");
me.s1 = mash(" ");
me.s2 = mash(" ");
me.s0 -= mash(seed);
if (me.s0 < 0) {
me.s0 += 1;
}
me.s1 -= mash(seed);
if (me.s1 < 0) {
me.s1 += 1;
}
me.s2 -= mash(seed);
if (me.s2 < 0) {
me.s2 += 1;
}
mash = null;
}
function copy(f, t) {
t.c = f.c;
t.s0 = f.s0;
t.s1 = f.s1;
t.s2 = f.s2;
return t;
}
function impl(seed, opts) {
var xg = new Alea(seed), state2 = opts && opts.state, prng = xg.next;
prng.int32 = function() {
return xg.next() * 4294967296 | 0;
};
prng.double = function() {
return prng() + (prng() * 2097152 | 0) * 11102230246251565e-32;
};
prng.quick = prng;
if (state2) {
if (typeof state2 == "object")
copy(state2, xg);
prng.state = function() {
return copy(xg, {});
};
}
return prng;
}
function Mash() {
var n = 4022871197;
var mash = function(data) {
data = String(data);
for (var i = 0; i < data.length; i++) {
n += data.charCodeAt(i);
var h = 0.02519603282416938 * n;
n = h >>> 0;
h -= n;
h *= n;
n = h >>> 0;
h -= n;
n += h * 4294967296;
}
return (n >>> 0) * 23283064365386963e-26;
};
return mash;
}
if (module3 && module3.exports) {
module3.exports = impl;
} else if (define2 && define2.amd) {
define2(function() {
return impl;
});
} else {
this.alea = impl;
}
})(exports, typeof module2 == "object" && module2, typeof define == "function" && define);
}
});
// node_modules/seedrandom/lib/xor128.js
var require_xor128 = __commonJS({
"node_modules/seedrandom/lib/xor128.js"(exports, module2) {
(function(global, module3, define2) {
function XorGen(seed) {
var me = this, strseed = "";
me.x = 0;
me.y = 0;
me.z = 0;
me.w = 0;
me.next = function() {
var t = me.x ^ me.x << 11;
me.x = me.y;
me.y = me.z;
me.z = me.w;
return me.w ^= me.w >>> 19 ^ t ^ t >>> 8;
};
if (seed === (seed | 0)) {
me.x = seed;
} else {
strseed += seed;
}
for (var k = 0; k < strseed.length + 64; k++) {
me.x ^= strseed.charCodeAt(k) | 0;
me.next();
}
}
function copy(f, t) {
t.x = f.x;
t.y = f.y;
t.z = f.z;
t.w = f.w;
return t;
}
function impl(seed, opts) {
var xg = new XorGen(seed), state2 = opts && opts.state, prng = function() {
return (xg.next() >>> 0) / 4294967296;
};
prng.double = function() {
do {
var top = xg.next() >>> 11, bot = (xg.next() >>> 0) / 4294967296, result = (top + bot) / (1 << 21);
} while (result === 0);
return result;
};
prng.int32 = xg.next;
prng.quick = prng;
if (state2) {
if (typeof state2 == "object")
copy(state2, xg);
prng.state = function() {
return copy(xg, {});
};
}
return prng;
}
if (module3 && module3.exports) {
module3.exports = impl;
} else if (define2 && define2.amd) {
define2(function() {
return impl;
});
} else {
this.xor128 = impl;
}
})(exports, typeof module2 == "object" && module2, typeof define == "function" && define);
}
});
// node_modules/seedrandom/lib/xorwow.js
var require_xorwow = __commonJS({
"node_modules/seedrandom/lib/xorwow.js"(exports, module2) {
(function(global, module3, define2) {
function XorGen(seed) {
var me = this, strseed = "";
me.next = function() {
var t = me.x ^ me.x >>> 2;
me.x = me.y;
me.y = me.z;
me.z = me.w;
me.w = me.v;
return (me.d = me.d + 362437 | 0) + (me.v = me.v ^ me.v << 4 ^ (t ^ t << 1)) | 0;
};
me.x = 0;
me.y = 0;
me.z = 0;
me.w = 0;
me.v = 0;
if (seed === (seed | 0)) {
me.x = seed;
} else {
strseed += seed;
}
for (var k = 0; k < strseed.length + 64; k++) {
me.x ^= strseed.charCodeAt(k) | 0;
if (k == strseed.length) {
me.d = me.x << 10 ^ me.x >>> 4;
}
me.next();
}
}
function copy(f, t) {
t.x = f.x;
t.y = f.y;
t.z = f.z;
t.w = f.w;
t.v = f.v;
t.d = f.d;
return t;
}
function impl(seed, opts) {
var xg = new XorGen(seed), state2 = opts && opts.state, prng = function() {
return (xg.next() >>> 0) / 4294967296;
};
prng.double = function() {
do {
var top = xg.next() >>> 11, bot = (xg.next() >>> 0) / 4294967296, result = (top + bot) / (1 << 21);
} while (result === 0);
return result;
};
prng.int32 = xg.next;
prng.quick = prng;
if (state2) {
if (typeof state2 == "object")
copy(state2, xg);
prng.state = function() {
return copy(xg, {});
};
}
return prng;
}
if (module3 && module3.exports) {
module3.exports = impl;
} else if (define2 && define2.amd) {
define2(function() {
return impl;
});
} else {
this.xorwow = impl;
}
})(exports, typeof module2 == "object" && module2, typeof define == "function" && define);
}
});
// node_modules/seedrandom/lib/xorshift7.js
var require_xorshift7 = __commonJS({
"node_modules/seedrandom/lib/xorshift7.js"(exports, module2) {
(function(global, module3, define2) {
function XorGen(seed) {
var me = this;
me.next = function() {
var X = me.x, i = me.i, t, v, w;
t = X[i];
t ^= t >>> 7;
v = t ^ t << 24;
t = X[i + 1 & 7];
v ^= t ^ t >>> 10;
t = X[i + 3 & 7];
v ^= t ^ t >>> 3;
t = X[i + 4 & 7];
v ^= t ^ t << 7;
t = X[i + 7 & 7];
t = t ^ t << 13;
v ^= t ^ t << 9;
X[i] = v;
me.i = i + 1 & 7;
return v;
};
function init(me2, seed2) {
var j, w, X = [];
if (seed2 === (seed2 | 0)) {
w = X[0] = seed2;
} else {
seed2 = "" + seed2;
for (j = 0; j < seed2.length; ++j) {
X[j & 7] = X[j & 7] << 15 ^ seed2.charCodeAt(j) + X[j + 1 & 7] << 13;
}
}
while (X.length < 8)
X.push(0);
for (j = 0; j < 8 && X[j] === 0; ++j)
;
if (j == 8)
w = X[7] = -1;
else
w = X[j];
me2.x = X;
me2.i = 0;
for (j = 256; j > 0; --j) {
me2.next();
}
}
init(me, seed);
}
function copy(f, t) {
t.x = f.x.slice();
t.i = f.i;
return t;
}
function impl(seed, opts) {
if (seed == null)
seed = +new Date();
var xg = new XorGen(seed), state2 = opts && opts.state, prng = function() {
return (xg.next() >>> 0) / 4294967296;
};
prng.double = function() {
do {
var top = xg.next() >>> 11, bot = (xg.next() >>> 0) / 4294967296, result = (top + bot) / (1 << 21);
} while (result === 0);
return result;
};
prng.int32 = xg.next;
prng.quick = prng;
if (state2) {
if (state2.x)
copy(state2, xg);
prng.state = function() {
return copy(xg, {});
};
}
return prng;
}
if (module3 && module3.exports) {
module3.exports = impl;
} else if (define2 && define2.amd) {
define2(function() {
return impl;
});
} else {
this.xorshift7 = impl;
}
})(exports, typeof module2 == "object" && module2, typeof define == "function" && define);
}
});
// node_modules/seedrandom/lib/xor4096.js
var require_xor4096 = __commonJS({
"node_modules/seedrandom/lib/xor4096.js"(exports, module2) {
(function(global, module3, define2) {
function XorGen(seed) {
var me = this;
me.next = function() {
var w = me.w, X = me.X, i = me.i, t, v;
me.w = w = w + 1640531527 | 0;
v = X[i + 34 & 127];
t = X[i = i + 1 & 127];
v ^= v << 13;
t ^= t << 17;
v ^= v >>> 15;
t ^= t >>> 12;
v = X[i] = v ^ t;
me.i = i;
return v + (w ^ w >>> 16) | 0;
};
function init(me2, seed2) {
var t, v, i, j, w, X = [], limit = 128;
if (seed2 === (seed2 | 0)) {
v = seed2;
seed2 = null;
} else {
seed2 = seed2 + "\0";
v = 0;
limit = Math.max(limit, seed2.length);
}
for (i = 0, j = -32; j < limit; ++j) {
if (seed2)
v ^= seed2.charCodeAt((j + 32) % seed2.length);
if (j === 0)
w = v;
v ^= v << 10;
v ^= v >>> 15;
v ^= v << 4;
v ^= v >>> 13;
if (j >= 0) {
w = w + 1640531527 | 0;
t = X[j & 127] ^= v + w;
i = t == 0 ? i + 1 : 0;
}
}
if (i >= 128) {
X[(seed2 && seed2.length || 0) & 127] = -1;
}
i = 127;
for (j = 4 * 128; j > 0; --j) {
v = X[i + 34 & 127];
t = X[i = i + 1 & 127];
v ^= v << 13;
t ^= t << 17;
v ^= v >>> 15;
t ^= t >>> 12;
X[i] = v ^ t;
}
me2.w = w;
me2.X = X;
me2.i = i;
}
init(me, seed);
}
function copy(f, t) {
t.i = f.i;
t.w = f.w;
t.X = f.X.slice();
return t;
}
;
function impl(seed, opts) {
if (seed == null)
seed = +new Date();
var xg = new XorGen(seed), state2 = opts && opts.state, prng = function() {
return (xg.next() >>> 0) / 4294967296;
};
prng.double = function() {
do {
var top = xg.next() >>> 11, bot = (xg.next() >>> 0) / 4294967296, result = (top + bot) / (1 << 21);
} while (result === 0);
return result;
};
prng.int32 = xg.next;
prng.quick = prng;
if (state2) {
if (state2.X)
copy(state2, xg);
prng.state = function() {
return copy(xg, {});
};
}
return prng;
}
if (module3 && module3.exports) {
module3.exports = impl;
} else if (define2 && define2.amd) {
define2(function() {
return impl;
});
} else {
this.xor4096 = impl;
}
})(exports, typeof module2 == "object" && module2, typeof define == "function" && define);
}
});
// node_modules/seedrandom/lib/tychei.js
var require_tychei = __commonJS({
"node_modules/seedrandom/lib/tychei.js"(exports, module2) {
(function(global, module3, define2) {
function XorGen(seed) {
var me = this, strseed = "";
me.next = function() {
var b = me.b, c = me.c, d = me.d, a = me.a;
b = b << 25 ^ b >>> 7 ^ c;
c = c - d | 0;
d = d << 24 ^ d >>> 8 ^ a;
a = a - b | 0;
me.b = b = b << 20 ^ b >>> 12 ^ c;
me.c = c = c - d | 0;
me.d = d << 16 ^ c >>> 16 ^ a;
return me.a = a - b | 0;
};
me.a = 0;
me.b = 0;
me.c = 2654435769 | 0;
me.d = 1367130551;
if (seed === Math.floor(seed)) {
me.a = seed / 4294967296 | 0;
me.b = seed | 0;
} else {
strseed += seed;
}
for (var k = 0; k < strseed.length + 20; k++) {
me.b ^= strseed.charCodeAt(k) | 0;
me.next();
}
}
function copy(f, t) {
t.a = f.a;
t.b = f.b;
t.c = f.c;
t.d = f.d;
return t;
}
;
function impl(seed, opts) {
var xg = new XorGen(seed), state2 = opts && opts.state, prng = function() {
return (xg.next() >>> 0) / 4294967296;
};
prng.double = function() {
do {
var top = xg.next() >>> 11, bot = (xg.next() >>> 0) / 4294967296, result = (top + bot) / (1 << 21);
} while (result === 0);
return result;
};
prng.int32 = xg.next;
prng.quick = prng;
if (state2) {
if (typeof state2 == "object")
copy(state2, xg);
prng.state = function() {
return copy(xg, {});
};
}
return prng;
}
if (module3 && module3.exports) {
module3.exports = impl;
} else if (define2 && define2.amd) {
define2(function() {
return impl;
});
} else {
this.tychei = impl;
}
})(exports, typeof module2 == "object" && module2, typeof define == "function" && define);
}
});
// node_modules/seedrandom/seedrandom.js
var require_seedrandom = __commonJS({
"node_modules/seedrandom/seedrandom.js"(exports, module2) {
(function(global, pool, math) {
var width = 256, chunks = 6, digits = 52, rngname = "random", startdenom = math.pow(width, chunks), significance = math.pow(2, digits), overflow = significance * 2, mask = width - 1, nodecrypto;
function seedrandom2(seed, options, callback) {
var key = [];
options = options == true ? { entropy: true } : options || {};
var shortseed = mixkey(flatten(options.entropy ? [seed, tostring(pool)] : seed == null ? autoseed() : seed, 3), key);
var arc4 = new ARC4(key);
var prng = function() {
var n = arc4.g(chunks), d = startdenom, x = 0;
while (n < significance) {
n = (n + x) * width;
d *= width;
x = arc4.g(1);
}
while (n >= overflow) {
n /= 2;
d /= 2;
x >>>= 1;
}
return (n + x) / d;
};
prng.int32 = function() {
return arc4.g(4) | 0;
};
prng.quick = function() {
return arc4.g(4) / 4294967296;
};
prng.double = prng;
mixkey(tostring(arc4.S), pool);
return (options.pass || callback || function(prng2, seed2, is_math_call, state2) {
if (state2) {
if (state2.S) {
copy(state2, arc4);
}
prng2.state = function() {
return copy(arc4, {});
};
}
if (is_math_call) {
math[rngname] = prng2;
return seed2;
} else
return prng2;
})(prng, shortseed, "global" in options ? options.global : this == math, options.state);
}
function ARC4(key) {
var t, keylen = key.length, me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];
if (!keylen) {
key = [keylen++];
}
while (i < width) {
s[i] = i++;
}
for (i = 0; i < width; i++) {
s[i] = s[j = mask & j + key[i % keylen] + (t = s[i])];
s[j] = t;
}
(me.g = function(count) {
var t2, r = 0, i2 = me.i, j2 = me.j, s2 = me.S;
while (count--) {
t2 = s2[i2 = mask & i2 + 1];
r = r * width + s2[mask & (s2[i2] = s2[j2 = mask & j2 + t2]) + (s2[j2] = t2)];
}
me.i = i2;
me.j = j2;
return r;
})(width);
}
function copy(f, t) {
t.i = f.i;
t.j = f.j;
t.S = f.S.slice();
return t;
}
;
function flatten(obj, depth) {
var result = [], typ = typeof obj, prop;
if (depth && typ == "object") {
for (prop in obj) {
try {
result.push(flatten(obj[prop], depth - 1));
} catch (e) {
}
}
}
return result.length ? result : typ == "string" ? obj : obj + "\0";
}
function mixkey(seed, key) {
var stringseed = seed + "", smear, j = 0;
while (j < stringseed.length) {
key[mask & j] = mask & (smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++);
}
return tostring(key);
}
function autoseed() {
try {
var out;
if (nodecrypto && (out = nodecrypto.randomBytes)) {
out = out(width);
} else {
out = new Uint8Array(width);
(global.crypto || global.msCrypto).getRandomValues(out);
}
return tostring(out);
} catch (e) {
var browser = global.navigator, plugins = browser && browser.plugins;
return [+new Date(), global, plugins, global.screen, tostring(pool)];
}
}
function tostring(a) {
return String.fromCharCode.apply(0, a);
}
mixkey(math.random(), pool);
if (typeof module2 == "object" && module2.exports) {
module2.exports = seedrandom2;
try {
nodecrypto = require("crypto");
} catch (ex) {
}
} else if (typeof define == "function" && define.amd) {
define(function() {
return seedrandom2;
});
} else {
math["seed" + rngname] = seedrandom2;
}
})(typeof self !== "undefined" ? self : exports, [], Math);
}
});
// node_modules/seedrandom/index.js
var require_seedrandom2 = __commonJS({
"node_modules/seedrandom/index.js"(exports, module2) {
var alea = require_alea();
var xor128 = require_xor128();
var xorwow = require_xorwow();
var xorshift7 = require_xorshift7();
var xor4096 = require_xor4096();
var tychei = require_tychei();
var sr = require_seedrandom();
sr.alea = alea;
sr.xor128 = xor128;
sr.xorwow = xorwow;
sr.xorshift7 = xorshift7;
sr.xor4096 = xor4096;
sr.tychei = tychei;
module2.exports = sr;
}
});
// src/index.ts

@@ -97,2 +753,3 @@ __export(exports, {

});
var import_seedrandom = __toModule(require_seedrandom2());

@@ -382,2 +1039,3 @@ // src/data/creditCardProviders.ts

var defaultLocale = null;
var random = (0, import_seedrandom.default)();
var throwNoDefaultLocale = () => {

@@ -392,2 +1050,5 @@ throw new Error(`No default locale defined. Import at least one locale!`);

};
var setSeed = (seed) => {
random = (0, import_seedrandom.default)(seed);
};
var getLocaleData = ({ locale: _locale, key }) => {

@@ -417,3 +1078,3 @@ if (!defaultLocale)

const { min, max, float } = { min: 0, max: 1, float: false, ...options };
const value = min + Math.random() * (max - min);
const value = min + random.quick() * (max - min);
if (!float)

@@ -865,3 +1526,4 @@ return Math.round(value);

filePath,
fileName
fileName,
setSeed
};

@@ -868,0 +1530,0 @@ // Annotate the CommonJS export names for ESM import in node:

10

package.json
{
"name": "minifaker",
"version": "1.22.0",
"version": "1.23.0",
"description": "lightweight faker.js",

@@ -14,3 +14,3 @@ "types": "./dist/index.d.ts",

"test": "jest --coverage",
"build": "ts-node bundle.ts && tsc ./src/index.ts --declaration --emitDeclarationOnly --downlevelIteration --outdir dist",
"build": "ts-node bundle.ts && tsc ./src/index.ts --declaration --emitDeclarationOnly --downlevelIteration --esModuleInterop --outdir dist",
"prepublishOnly": "npm run build"

@@ -27,2 +27,3 @@ },

"@types/jest": "^27.0.3",
"@types/seedrandom": "^3.0.1",
"esbuild": "^0.14.0",

@@ -33,3 +34,6 @@ "jest": "^27.3.1",

"ts-node": "^10.4.0"
},
"dependencies": {
"seedrandom": "^3.0.5"
}
}
}

@@ -137,1 +137,2 @@ # minifaker

dirPath|n/a|dirPath
seed|n/a|setSeed

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc