Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@randajan/jet-core

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@randajan/jet-core - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

178

dist/index.js

@@ -38,8 +38,8 @@ var __defProp = Object.defineProperty;

};
var getByInst = (any2, def, withDef = true) => {
if (!def.is || def.is(any2)) {
var getByInst = (any, def, withDef = true) => {
if (!def.is || def.is(any)) {
return withDef ? def : def.name;
}
};
var findByProto = (any2, proto, withDef = true) => {
var findByProto = (any, proto, withDef = true) => {
const list = byPrototype.get(proto);

@@ -50,6 +50,6 @@ if (!list) {

if (list.length === 1) {
return getByInst(any2, list[0], withDef);
return getByInst(any, list[0], withDef);
}
for (const def of list) {
const r = getByInst(any2, def, withDef);
const r = getByInst(any, def, withDef);
if (r) {

@@ -60,17 +60,17 @@ return r;

};
var findByInst = (any2, strict, withDef = true) => {
if (any2 == null) {
var findByInst = (any, strict, withDef = true) => {
if (any == null) {
return;
}
if (strict) {
return findByProto(any2, any2.__proto__, withDef);
return findByProto(any, any.__proto__, withDef);
}
let r, p = any2;
let r, p = any;
do {
r = findByProto(any2, p = p.__proto__, withDef);
r = findByProto(any, p = p.__proto__, withDef);
} while (p && r === void 0);
return r;
};
var getDefByInst = (any2, strict = true) => findByInst(any2, strict, true);
var getNameByInst = (any2, strict = true) => findByInst(any2, strict, false);
var getDefByInst = (any, strict = true) => findByInst(any, strict, true);
var getNameByInst = (any, strict = true) => findByInst(any, strict, false);
var register = (def) => {

@@ -92,8 +92,8 @@ byName[def.name] = def;

var magic = ["only", "full", "tap", "pull", "is", "to", "copy", "rnd"];
var isInstance = (any2) => {
const t = typeof any2;
return any2 != null && (t === "function" || t === "object");
var isInstance = (any) => {
const t = typeof any;
return any != null && (t === "function" || t === "object");
};
var isInstanceOf = (constructor, any2) => any2 instanceof constructor;
var is = (name, any2, strict = true) => {
var isInstanceOf = (constructor, any) => any instanceof constructor;
var is = (name, any, strict = true) => {
if (!name) {

@@ -104,27 +104,27 @@ return false;

if (def) {
if (any2 == null) {
if (any == null) {
return false;
}
if (strict && any2.__proto__ !== def.prototype) {
if (strict && any.__proto__ !== def.prototype) {
return false;
}
if (!strict && !(any2 instanceof def.constructor)) {
if (!strict && !(any instanceof def.constructor)) {
return false;
}
return !def.is || def.is(any2);
return !def.is || def.is(any);
}
const nt = typeof name;
if (nt === "string") {
return typeof any2 === name;
return typeof any === name;
}
if (any2 == null || nt !== "function" && nt !== "object") {
if (any == null || nt !== "function" && nt !== "object") {
return false;
}
return strict ? any2.constructor === name : any2 instanceof name;
return strict ? any.constructor === name : any instanceof name;
};
var isFull = (any2, vals) => {
var isFull = (any, vals) => {
if (!vals) {
return any2 === false || any2 === 0 || !!any2;
return any === false || any === 0 || !!any;
}
for (let v of vals(any2)) {
for (let v of vals(any)) {
if (v != null) {

@@ -147,3 +147,3 @@ return true;

if (def) {
return _touch(def, op, err, any, ...args);
return _touch(def, op, err, ...args);
}

@@ -154,9 +154,9 @@ if (err) {

};
var touchBy = (any2, op, err, ...args) => {
const def = getDefByInst(any2, false);
var touchBy = (any, op, err, ...args) => {
const def = getDefByInst(any, false);
if (def) {
return _touch(def, op, err, any2, ...args);
return _touch(def, op, err, any, ...args);
}
if (err) {
throwError(`unable execute '${op}' - missing type of '${any2}'`);
throwError(`unable execute '${op}' - missing type of '${any}'`);
}

@@ -190,3 +190,3 @@ };

};
var to = (name, any2, ...args) => {
var to = (name, any, ...args) => {
const def = getDefByName(name);

@@ -196,3 +196,3 @@ if (!def) {

}
const at = getDefByInst(any2, false);
const at = getDefByInst(any, false);
if (!at) {

@@ -202,6 +202,6 @@ return def.create();

if (def.name === at.name) {
return any2;
return any;
}
const exe = at.to[name] || at.to["*"];
return exe ? to(name, exe(any2, ...args), ...args) : def.create(any2);
return exe ? to(name, exe(any, ...args), ...args) : def.create(any);
};

@@ -253,3 +253,3 @@ var toDefine = (from, to3, exe) => {

create = create || ((...a) => new constructor(...a));
copy = copy || ((any2) => any2);
copy = copy || ((any) => any);
const ec = extendConstructor === false ? null : typeof extendConstructor === "object" ? extendConstructor : {};

@@ -288,4 +288,4 @@ const ep = extendPrototype === false ? null : typeof extendPrototype === "object" ? extendPrototype : {};

ex(0, "create", create);
ex(0, "is", (any2, strict = true) => is(name, any2, strict));
ex(0, "to", (any2, ...a) => to(name, any2, ...a));
ex(0, "is", (any, strict = true) => is(name, any, strict));
ex(0, "to", (any, ...a) => to(name, any, ...a));
ex(0, "only", (...a) => factory(name, 0, ...a));

@@ -296,3 +296,3 @@ ex(0, "full", (...a) => factory(name, 1, ...a));

ex(0, "rnd", rnd = rnd || create);
ex(2, "isFull", full = full || ((any2) => isFull(any2, vals)));
ex(2, "isFull", full = full || ((any) => isFull(any, vals)));
if (entries) {

@@ -305,3 +305,3 @@ ex(2, "keys", keys);

ex(2, "rem", rem = rem || ((x, k) => delete x[k]));
ex(2, "getRND", (any2, min, max, sqr) => getRND(vals(any2), min, max, sqr));
ex(2, "getRND", (any, min, max, sqr) => getRND(vals(any), min, max, sqr));
}

@@ -341,5 +341,5 @@ register({ name, constructor, prototype, is: is2, create, full, copy, rnd, keys, vals, entries, get, set, rem, to: {} });

});
var _each = ({ create, entries, set }, any2, fce, deep, dprun, dir, flat) => {
var _each = ({ create, entries, set }, any, fce, deep, dprun, dir, flat) => {
const res = flat || create();
for (let [key, val] of entries(any2)) {
for (let [key, val] of entries(any)) {
const path = (dir ? dir + "." : "") + key;

@@ -367,10 +367,10 @@ const def = deep || !fce ? getDefByInst(val) : null;

};
var _eachInit = (any2, fce, deep, dir, flat) => {
const df = getDefByInst(any2);
var _eachInit = (any, fce, deep, dir, flat) => {
const df = getDefByInst(any);
dir = String.jet.to(dir, ".");
if (df && df.entries) {
return _each(df, any2, fce, deep, defs_default.isRunnable(deep), dir, flat);
return _each(df, any, fce, deep, defs_default.isRunnable(deep), dir, flat);
}
;
const val = fce ? fce(any2, dir, "", dir) : df.copy ? df.copy(any2) : any2;
const val = fce ? fce(any, dir, "", dir) : df.copy ? df.copy(any) : any;
if (flat && val !== void 0) {

@@ -381,4 +381,4 @@ flat.push(val);

};
var forEach = (any2, fce, deep = false, dir = "") => _eachInit(any2, fce, deep, dir, []);
var map = (any2, fce, deep = false, dir = "") => _eachInit(any2, fce, deep, dir);
var forEach = (any, fce, deep = false, dir = "") => _eachInit(any, fce, deep, dir, []);
var map = (any, fce, deep = false, dir = "") => _eachInit(any, fce, deep, dir);
var reducer = (reductor) => {

@@ -388,3 +388,3 @@ let i = 0, next;

};
var dig = (any2, path, reductor) => {
var dig = (any, path, reductor) => {
const pa = String.jet.to(path, ".").split(".");

@@ -395,17 +395,17 @@ const end = pa.length - 1;

return reductor(next, parent, (dir ? dir + "." : "") + pa[index], dir, pa[index], index === end);
})(any2);
})(any);
};
var digOut = (any2, path, def) => {
var digOut = (any, path, def) => {
path = String.jet.to(path, ".");
if (!path) {
return any2;
return any;
}
for (let p of path.split(".")) {
if ((any2 = defs_default.get(any2, p, false)) == null) {
if ((any = defs_default.get(any, p, false)) == null) {
return def;
}
}
return any2;
return any;
};
var digIn = (any2, path, val, force = true, reductor = void 0) => {
var digIn = (any, path, val, force = true, reductor = void 0) => {
const step = (next, parent, path2, dir, key, isEnd) => {

@@ -430,5 +430,5 @@ let df = getDefByInst(parent);

};
return dig(any2, path, !defs_default.isRunnable(reductor) ? step : (next, parent, path2, dir, key, isEnd) => reductor((parent2) => step(next, parent2, path2, dir, key, isEnd), parent, path2, dir, key, isEnd));
return dig(any, path, !defs_default.isRunnable(reductor) ? step : (next, parent, path2, dir, key, isEnd) => reductor((parent2) => step(next, parent2, path2, dir, key, isEnd), parent, path2, dir, key, isEnd));
};
var deflate = (any2, includeMapable = false) => {
var deflate = (any, includeMapable = false) => {
const flat = {};

@@ -442,3 +442,3 @@ const add = (v, p) => {

};
forEach(any2, add, includeMapable ? deep : true);
forEach(any, add, includeMapable ? deep : true);
return flat;

@@ -456,3 +456,3 @@ };

};
var _assign = (overwriteArray, to3, ...any2) => {
var _assign = (overwriteArray, to3, ...any) => {
const r = { to: to3 };

@@ -473,3 +473,3 @@ const flat = deflate(r.to, true);

};
for (const a of any2) {
for (const a of any) {
forEach(a, add, !!overwriteArray || acumulate);

@@ -480,9 +480,9 @@ }

var assign = (to3, from, overwriteArray = true) => _assign(overwriteArray, to3, from);
var merge = (...any2) => _assign(false, {}, ...any2);
var melt = (any2, comma) => {
var merge = (...any) => _assign(false, {}, ...any);
var melt = (any, comma) => {
let j = "", c = String.jet.to(comma);
if (!defs_default.isMapable(any2)) {
return String.jet.to(any2, c);
if (!defs_default.isMapable(any)) {
return String.jet.to(any, c);
}
forEach(any2, (v) => {
forEach(any, (v) => {
v = melt(v, c);

@@ -540,11 +540,11 @@ j += v ? (j ? c : "") + v : "";

to,
isFull: (any2) => {
const def = getDefByInst(any2, false);
return def ? def.full(any2) : isFull(any2);
isFull: (any) => {
const def = getDefByInst(any, false);
return def ? def.full(any) : isFull(any);
},
isMapable: (any2, strict = true) => {
const def = getDefByInst(any2, strict);
isMapable: (any, strict = true) => {
const def = getDefByInst(any, strict);
return def ? !!def.entries : false;
},
isRunnable: (any2) => typeof any2 === "function",
isRunnable: (any) => typeof any === "function",
full: (...a) => factory(null, 1, ...a),

@@ -556,22 +556,22 @@ only: (name, ...a) => factory(name, 0, ...a),

rnd: (name, ...a) => touch(name, "rnd", true, ...a),
copy: (any2, deep = false, copyUnmapable = false) => deep ? defs_default.map(any2, copyUnmapable ? void 0 : (_) => _, true) : touchBy(any2, "copy"),
keys: (any2, throwError2 = false) => touchBy(any2, "keys", throwError2) || [],
vals: (any2, throwError2 = false) => touchBy(any2, "vals", throwError2) || [],
entries: (any2, throwError2 = false) => touchBy(any2, "entries", throwError2) || [],
get: (any2, key, throwError2 = false) => touchBy(any2, "get", throwError2, key),
set: (any2, key, val, throwError2 = false) => touchBy(any2, "set", throwError2, key, val),
rem: (any2, key, throwError2 = true) => touchBy(any2, "rem", throwError2, key),
getRND: (any2, min, max, sqr) => {
const def = getDefByInst(any2);
copy: (any, deep = false, copyUnmapable = false) => deep ? defs_default.map(any, copyUnmapable ? void 0 : (_) => _, true) : touchBy(any, "copy"),
keys: (any, throwError2 = false) => touchBy(any, "keys", throwError2) || [],
vals: (any, throwError2 = false) => touchBy(any, "vals", throwError2) || [],
entries: (any, throwError2 = false) => touchBy(any, "entries", throwError2) || [],
get: (any, key, throwError2 = false) => touchBy(any, "get", throwError2, key),
set: (any, key, val, throwError2 = false) => touchBy(any, "set", throwError2, key, val),
rem: (any, key, throwError2 = true) => touchBy(any, "rem", throwError2, key),
getRND: (any, min, max, sqr) => {
const def = getDefByInst(any);
if (def && def.vals) {
any2 = def.vals(any2);
} else if (typeof any2 === "string") {
return getRND(any2, min, max, sqr);
any = def.vals(any);
} else if (typeof any === "string") {
return getRND(any, min, max, sqr);
}
},
run: (any2, ...args) => {
if (defs_default.isRunnable(any2)) {
return [any2(...args)];
run: (any, ...args) => {
if (defs_default.isRunnable(any)) {
return [any(...args)];
}
return defs_default.map(any2, (f) => defs_default.run(f, ...args));
return defs_default.map(any, (f) => defs_default.run(f, ...args));
},

@@ -724,3 +724,3 @@ ...pile_exports,

var String_default = jet_default.define("String", String, {
create: (any2) => any2 == null ? "" : String(any2),
create: (any) => any == null ? "" : String(any),
rnd: (min, max, sqr) => {

@@ -727,0 +727,0 @@ const c = ["bcdfghjklmnpqrstvwxz", "aeiouy"], p = c[0].length / (c[0].length + c[1].length);

{
"name": "@randajan/jet-core",
"version": "3.0.0",
"version": "3.0.1",
"description": "Ecosystem of types and related usefull tools.",

@@ -5,0 +5,0 @@ "repository": "randajan/jet-core",

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