@theconcurrent/utility
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -1,2 +0,2 @@ | ||
(function(i,f){typeof exports=="object"&&typeof module!="undefined"?f(exports,require("graphql")):typeof define=="function"&&define.amd?define(["exports","graphql"],f):(i=typeof globalThis!="undefined"?globalThis:i||self,f(i["@theconcurrent/utility"]={},i.graphql))})(this,function(i,f){"use strict";function a(n,t,r){return n.find(e=>e[t]===r)}function T(n,t){return n.filter(r=>t in r)}function m(n,t,r){return n.sort((e,u)=>{const c=t.indexOf(String(e[r])),y=t.indexOf(String(u[r]));return c===-1?1:y===-1?-1:c-y})}function s(n,t){return a(n,"typeName",t)}function d(n,t,r){var o;const e=s(n,t);if(!e||e.kind!=="Object"||!e.fields)return;if(r.length===0)return e;const[u,...c]=r,y=(o=e.fields.find(L=>L.name===u))==null?void 0:o.typeName;if(y)return d(n,y,c)}function l(n,t,r,e=[],u){if(u<0)return;const c=s(n,t);if(!(!c||e.includes(t))&&(e.push(t),!(c.kind!=="Object"||!c.fields)))for(const y of c.fields){if(y.typeName===r)return y.name;const o=l(n,y.typeName,r,e,u-1);if(o)return`${y.name}.${o}`}}function h(n,t,r,e){const u=l(n,t,r,[],0);if(u)return`${e}${u}`}function N(n,t){const r=t.split(".");if(r[0]!==n.name)return null;let e=n;for(const u of r.slice(1)){if(!e||!e.fields)return null;const c=e.fields.find(y=>y.name===u);if(!c)return null;e=c}return e}function I(n,t){const r=t.split(".");let e=n;return r.forEach(u=>{typeof e=="object"&&e!==null&&u in e?e=e[u]:e=null}),e}function p(n,t,r,e){if(e.length===0)return null;const u=e[0];if(n[r]===u){if(e.length===1)return n;const c=n[t];if(Array.isArray(c))return c.reduce((y,o)=>y||p(o,t,r,e.slice(1)),null)}return null}function A(n,t,r,e){const u=e.split(".");return n.reduce((c,y)=>c||p(y,t,r,u),null)}function B(n){return f.isEnumType(n.type)||f.isNonNullType(n.type)&&f.isEnumType(n.type.ofType)}function P(n){return f.isListType(n.type)||f.isNonNullType(n.type)&&f.isListType(n.type.ofType)}function E(n){return!!(f.isScalarType(n.type)||f.isNonNullType(n.type)&&(f.isScalarType(n.type.ofType)||f.isListType(n.type.ofType)&&(f.isScalarType(n.type.ofType.ofType)||f.isNonNullType(n.type.ofType.ofType)&&f.isScalarType(n.type.ofType.ofType.ofType))))}function v(n){return n.charAt(0).toLowerCase()+n.slice(1)}i.checkIsEnum=B,i.checkIsList=P,i.checkIsScalar=E,i.findEntityFromPath=d,i.findInArray=A,i.findPathToEntity=l,i.findValue=I,i.generatePath=h,i.getEntityByName=s,i.getField=N,i.getItemByKeyAndValue=a,i.getItemsByHavingKey=T,i.lowercaseFirstLetter=v,i.sortDataByOrder=m,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}); | ||
(function(i,u){typeof exports=="object"&&typeof module!="undefined"?u(exports,require("graphql")):typeof define=="function"&&define.amd?define(["exports","graphql"],u):(i=typeof globalThis!="undefined"?globalThis:i||self,u(i["@theconcurrent/utility"]={},i.graphql))})(this,function(i,u){"use strict";function l(e,n,r){return e.find(t=>t[n]===r)}function p(e,n){return e.filter(r=>n in r)}function T(e,n,r){return e.sort((t,o)=>{const f=n.indexOf(String(t[r])),y=n.indexOf(String(o[r]));return f===-1?1:y===-1?-1:f-y})}function s(e,n){return l(e,"typeName",n)}function d(e,n,r){var c;const t=s(e,n);if(!t||t.kind!=="Object"||!t.fields)return;if(r.length===0)return t;const[o,...f]=r,y=(c=t.fields.find(E=>E.name===o))==null?void 0:c.typeName;if(y)return d(e,y,f)}function a(e,n,r,t=[],o){if(o<0)return;const f=s(e,n);if(!(!f||t.includes(n))&&(t.push(n),!(f.kind!=="Object"||!f.fields)))for(const y of f.fields){if(y.typeName===r)return y.name;const c=a(e,y.typeName,r,t,o-1);if(c)return`${y.name}.${c}`}}function m(e,n,r,t){const o=a(e,n,r,[],0);if(o)return`${t}${o}`}function h(e,n){const r=n.split(".");if(r[0]!==e.name)return null;let t=e;for(const o of r.slice(1)){if(!t||!t.fields)return null;const f=t.fields.find(y=>y.name===o);if(!f)return null;t=f}return t}function N(e,n){const r=n.split(".");let t=e;return r.forEach(o=>{typeof t=="object"&&t!==null&&o in t?t=t[o]:t=null}),t}function P(e){return u.isEnumType(e.type)||u.isNonNullType(e.type)&&u.isEnumType(e.type.ofType)}function I(e){return u.isListType(e.type)||u.isNonNullType(e.type)&&u.isListType(e.type.ofType)}function S(e){return!!(u.isScalarType(e.type)||u.isNonNullType(e.type)&&(u.isScalarType(e.type.ofType)||u.isListType(e.type.ofType)&&(u.isScalarType(e.type.ofType.ofType)||u.isNonNullType(e.type.ofType.ofType)&&u.isScalarType(e.type.ofType.ofType.ofType))))}function B(e){return e.charAt(0).toLowerCase()+e.slice(1)}i.checkIsEnum=P,i.checkIsList=I,i.checkIsScalar=S,i.findEntityFromPath=d,i.findPathToEntity=a,i.findValue=N,i.generatePath=m,i.getEntityByName=s,i.getField=h,i.getItemByKeyAndValue=l,i.getItemsByHavingKey=p,i.lowercaseFirstLetter=B,i.sortDataByOrder=T,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}); | ||
//# sourceMappingURL=index.umd.js.map |
import { getItemByKeyAndValue, getItemsByHavingKey, sortDataByOrder } from './dictionaryArray'; | ||
import { findEntityFromPath, findPathToEntity, generatePath, getEntityByName } from './entity'; | ||
import { getField } from './field'; | ||
import { findInArray, findValue } from './finder'; | ||
import findValue from './findValue'; | ||
import { checkIsEnum, checkIsList, checkIsScalar } from './graphql'; | ||
import lowercaseFirstLetter from './lowercaseFirstLetter'; | ||
export { findInArray, findValue }; | ||
export { findValue }; | ||
export { findEntityFromPath, findPathToEntity, generatePath, getEntityByName, getField, getItemByKeyAndValue, getItemsByHavingKey, lowercaseFirstLetter, sortDataByOrder, }; | ||
export { checkIsEnum, checkIsList, checkIsScalar }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,44 +0,44 @@ | ||
import { isEnumType as p, isNonNullType as y, isListType as s, isScalarType as c } from "graphql"; | ||
function h(n, r, e) { | ||
return n.find((t) => t[r] === e); | ||
import { isEnumType as s, isNonNullType as y, isListType as p, isScalarType as c } from "graphql"; | ||
function T(t, e, r) { | ||
return t.find((n) => n[e] === r); | ||
} | ||
function g(n, r) { | ||
return n.filter((e) => r in e); | ||
function g(t, e) { | ||
return t.filter((r) => e in r); | ||
} | ||
function v(n, r, e) { | ||
return n.sort((t, u) => { | ||
const i = r.indexOf(String(t[e])), o = r.indexOf(String(u[e])); | ||
return i === -1 ? 1 : o === -1 ? -1 : i - o; | ||
function P(t, e, r) { | ||
return t.sort((n, i) => { | ||
const u = e.indexOf(String(n[r])), o = e.indexOf(String(i[r])); | ||
return u === -1 ? 1 : o === -1 ? -1 : u - o; | ||
}); | ||
} | ||
function l(n, r) { | ||
return h(n, "typeName", r); | ||
function a(t, e) { | ||
return T(t, "typeName", e); | ||
} | ||
function m(n, r, e) { | ||
function m(t, e, r) { | ||
var f; | ||
const t = l(n, r); | ||
if (!t || t.kind !== "Object" || !t.fields) | ||
const n = a(t, e); | ||
if (!n || n.kind !== "Object" || !n.fields) | ||
return; | ||
if (e.length === 0) | ||
return t; | ||
const [u, ...i] = e, o = (f = t.fields.find( | ||
(T) => T.name === u | ||
if (r.length === 0) | ||
return n; | ||
const [i, ...u] = r, o = (f = n.fields.find( | ||
(d) => d.name === i | ||
)) == null ? void 0 : f.typeName; | ||
if (o) | ||
return m(n, o, i); | ||
return m(t, o, u); | ||
} | ||
function a(n, r, e, t = [], u) { | ||
if (u < 0) | ||
function l(t, e, r, n = [], i) { | ||
if (i < 0) | ||
return; | ||
const i = l(n, r); | ||
if (!(!i || t.includes(r)) && (t.push(r), !(i.kind !== "Object" || !i.fields))) | ||
for (const o of i.fields) { | ||
if (o.typeName === e) | ||
const u = a(t, e); | ||
if (!(!u || n.includes(e)) && (n.push(e), !(u.kind !== "Object" || !u.fields))) | ||
for (const o of u.fields) { | ||
if (o.typeName === r) | ||
return o.name; | ||
const f = a( | ||
const f = l( | ||
t, | ||
o.typeName, | ||
r, | ||
n, | ||
o.typeName, | ||
e, | ||
t, | ||
u - 1 | ||
i - 1 | ||
); | ||
@@ -49,89 +49,56 @@ if (f) | ||
} | ||
function x(n, r, e, t) { | ||
const u = a(n, r, e, [], 0); | ||
if (u) | ||
return `${t}${u}`; | ||
function v(t, e, r, n) { | ||
const i = l(t, e, r, [], 0); | ||
if (i) | ||
return `${n}${i}`; | ||
} | ||
function B(n, r) { | ||
const e = r.split("."); | ||
if (e[0] !== n.name) | ||
function x(t, e) { | ||
const r = e.split("."); | ||
if (r[0] !== t.name) | ||
return null; | ||
let t = n; | ||
for (const u of e.slice(1)) { | ||
if (!t || !t.fields) | ||
let n = t; | ||
for (const i of r.slice(1)) { | ||
if (!n || !n.fields) | ||
return null; | ||
const i = t.fields.find((o) => o.name === u); | ||
if (!i) | ||
const u = n.fields.find((o) => o.name === i); | ||
if (!u) | ||
return null; | ||
t = i; | ||
n = u; | ||
} | ||
return t; | ||
return n; | ||
} | ||
function I(n, r) { | ||
const e = r.split("."); | ||
let t = n; | ||
return e.forEach((u) => { | ||
typeof t == "object" && t !== null && u in t ? t = t[u] : t = null; | ||
}), t; | ||
function A(t, e) { | ||
const r = e.split("."); | ||
let n = t; | ||
return r.forEach((i) => { | ||
typeof n == "object" && n !== null && i in n ? n = n[i] : n = null; | ||
}), n; | ||
} | ||
function d(n, r, e, t) { | ||
if (t.length === 0) | ||
return null; | ||
const u = t[0]; | ||
if (n[e] === u) { | ||
if (t.length === 1) | ||
return n; | ||
const i = n[r]; | ||
if (Array.isArray(i)) | ||
return i.reduce( | ||
(o, f) => ( | ||
// eslint-disable-next-line | ||
o || d( | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
f, | ||
r, | ||
e, | ||
t.slice(1) | ||
) | ||
), | ||
null | ||
); | ||
} | ||
return null; | ||
function B(t) { | ||
return s(t.type) || y(t.type) && s(t.type.ofType); | ||
} | ||
function N(n, r, e, t) { | ||
const u = t.split("."); | ||
return n.reduce( | ||
(i, o) => i || d(o, r, e, u), | ||
null | ||
); | ||
function I(t) { | ||
return p(t.type) || y(t.type) && p(t.type.ofType); | ||
} | ||
function P(n) { | ||
return p(n.type) || y(n.type) && p(n.type.ofType); | ||
function N(t) { | ||
return !!(c(t.type) || y(t.type) && (c(t.type.ofType) || p(t.type.ofType) && (c(t.type.ofType.ofType) || y(t.type.ofType.ofType) && c(t.type.ofType.ofType.ofType)))); | ||
} | ||
function O(n) { | ||
return s(n.type) || y(n.type) && s(n.type.ofType); | ||
function O(t) { | ||
return t.charAt(0).toLowerCase() + t.slice(1); | ||
} | ||
function E(n) { | ||
return !!(c(n.type) || y(n.type) && (c(n.type.ofType) || s(n.type.ofType) && (c(n.type.ofType.ofType) || y(n.type.ofType.ofType) && c(n.type.ofType.ofType.ofType)))); | ||
} | ||
function L(n) { | ||
return n.charAt(0).toLowerCase() + n.slice(1); | ||
} | ||
export { | ||
P as checkIsEnum, | ||
O as checkIsList, | ||
E as checkIsScalar, | ||
B as checkIsEnum, | ||
I as checkIsList, | ||
N as checkIsScalar, | ||
m as findEntityFromPath, | ||
N as findInArray, | ||
a as findPathToEntity, | ||
I as findValue, | ||
x as generatePath, | ||
l as getEntityByName, | ||
B as getField, | ||
h as getItemByKeyAndValue, | ||
l as findPathToEntity, | ||
A as findValue, | ||
v as generatePath, | ||
a as getEntityByName, | ||
x as getField, | ||
T as getItemByKeyAndValue, | ||
g as getItemsByHavingKey, | ||
L as lowercaseFirstLetter, | ||
v as sortDataByOrder | ||
O as lowercaseFirstLetter, | ||
P as sortDataByOrder | ||
}; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1,2 +0,2 @@ | ||
(function(i,f){typeof exports=="object"&&typeof module!="undefined"?f(exports,require("graphql")):typeof define=="function"&&define.amd?define(["exports","graphql"],f):(i=typeof globalThis!="undefined"?globalThis:i||self,f(i["@theconcurrent/utility"]={},i.graphql))})(this,function(i,f){"use strict";function a(n,t,r){return n.find(e=>e[t]===r)}function T(n,t){return n.filter(r=>t in r)}function m(n,t,r){return n.sort((e,u)=>{const c=t.indexOf(String(e[r])),y=t.indexOf(String(u[r]));return c===-1?1:y===-1?-1:c-y})}function s(n,t){return a(n,"typeName",t)}function d(n,t,r){var o;const e=s(n,t);if(!e||e.kind!=="Object"||!e.fields)return;if(r.length===0)return e;const[u,...c]=r,y=(o=e.fields.find(L=>L.name===u))==null?void 0:o.typeName;if(y)return d(n,y,c)}function l(n,t,r,e=[],u){if(u<0)return;const c=s(n,t);if(!(!c||e.includes(t))&&(e.push(t),!(c.kind!=="Object"||!c.fields)))for(const y of c.fields){if(y.typeName===r)return y.name;const o=l(n,y.typeName,r,e,u-1);if(o)return`${y.name}.${o}`}}function h(n,t,r,e){const u=l(n,t,r,[],0);if(u)return`${e}${u}`}function N(n,t){const r=t.split(".");if(r[0]!==n.name)return null;let e=n;for(const u of r.slice(1)){if(!e||!e.fields)return null;const c=e.fields.find(y=>y.name===u);if(!c)return null;e=c}return e}function I(n,t){const r=t.split(".");let e=n;return r.forEach(u=>{typeof e=="object"&&e!==null&&u in e?e=e[u]:e=null}),e}function p(n,t,r,e){if(e.length===0)return null;const u=e[0];if(n[r]===u){if(e.length===1)return n;const c=n[t];if(Array.isArray(c))return c.reduce((y,o)=>y||p(o,t,r,e.slice(1)),null)}return null}function A(n,t,r,e){const u=e.split(".");return n.reduce((c,y)=>c||p(y,t,r,u),null)}function B(n){return f.isEnumType(n.type)||f.isNonNullType(n.type)&&f.isEnumType(n.type.ofType)}function P(n){return f.isListType(n.type)||f.isNonNullType(n.type)&&f.isListType(n.type.ofType)}function E(n){return!!(f.isScalarType(n.type)||f.isNonNullType(n.type)&&(f.isScalarType(n.type.ofType)||f.isListType(n.type.ofType)&&(f.isScalarType(n.type.ofType.ofType)||f.isNonNullType(n.type.ofType.ofType)&&f.isScalarType(n.type.ofType.ofType.ofType))))}function v(n){return n.charAt(0).toLowerCase()+n.slice(1)}i.checkIsEnum=B,i.checkIsList=P,i.checkIsScalar=E,i.findEntityFromPath=d,i.findInArray=A,i.findPathToEntity=l,i.findValue=I,i.generatePath=h,i.getEntityByName=s,i.getField=N,i.getItemByKeyAndValue=a,i.getItemsByHavingKey=T,i.lowercaseFirstLetter=v,i.sortDataByOrder=m,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}); | ||
(function(i,u){typeof exports=="object"&&typeof module!="undefined"?u(exports,require("graphql")):typeof define=="function"&&define.amd?define(["exports","graphql"],u):(i=typeof globalThis!="undefined"?globalThis:i||self,u(i["@theconcurrent/utility"]={},i.graphql))})(this,function(i,u){"use strict";function l(e,n,r){return e.find(t=>t[n]===r)}function p(e,n){return e.filter(r=>n in r)}function T(e,n,r){return e.sort((t,o)=>{const f=n.indexOf(String(t[r])),y=n.indexOf(String(o[r]));return f===-1?1:y===-1?-1:f-y})}function s(e,n){return l(e,"typeName",n)}function d(e,n,r){var c;const t=s(e,n);if(!t||t.kind!=="Object"||!t.fields)return;if(r.length===0)return t;const[o,...f]=r,y=(c=t.fields.find(E=>E.name===o))==null?void 0:c.typeName;if(y)return d(e,y,f)}function a(e,n,r,t=[],o){if(o<0)return;const f=s(e,n);if(!(!f||t.includes(n))&&(t.push(n),!(f.kind!=="Object"||!f.fields)))for(const y of f.fields){if(y.typeName===r)return y.name;const c=a(e,y.typeName,r,t,o-1);if(c)return`${y.name}.${c}`}}function m(e,n,r,t){const o=a(e,n,r,[],0);if(o)return`${t}${o}`}function h(e,n){const r=n.split(".");if(r[0]!==e.name)return null;let t=e;for(const o of r.slice(1)){if(!t||!t.fields)return null;const f=t.fields.find(y=>y.name===o);if(!f)return null;t=f}return t}function N(e,n){const r=n.split(".");let t=e;return r.forEach(o=>{typeof t=="object"&&t!==null&&o in t?t=t[o]:t=null}),t}function P(e){return u.isEnumType(e.type)||u.isNonNullType(e.type)&&u.isEnumType(e.type.ofType)}function I(e){return u.isListType(e.type)||u.isNonNullType(e.type)&&u.isListType(e.type.ofType)}function S(e){return!!(u.isScalarType(e.type)||u.isNonNullType(e.type)&&(u.isScalarType(e.type.ofType)||u.isListType(e.type.ofType)&&(u.isScalarType(e.type.ofType.ofType)||u.isNonNullType(e.type.ofType.ofType)&&u.isScalarType(e.type.ofType.ofType.ofType))))}function B(e){return e.charAt(0).toLowerCase()+e.slice(1)}i.checkIsEnum=P,i.checkIsList=I,i.checkIsScalar=S,i.findEntityFromPath=d,i.findPathToEntity=a,i.findValue=N,i.generatePath=m,i.getEntityByName=s,i.getField=h,i.getItemByKeyAndValue=l,i.getItemsByHavingKey=p,i.lowercaseFirstLetter=B,i.sortDataByOrder=T,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@theconcurrent/utility", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"main": "./dist/index.umd.js", | ||
@@ -29,3 +29,3 @@ "module": "./dist/index.es.js", | ||
}, | ||
"gitHead": "65f44097b9fb1d2ec36c92b8d530db725aa71f52" | ||
"gitHead": "2dadaf04eec8dd75c0e6b9e0a384f8b30f48afdb" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
37514
202
1