@theconcurrent/utility
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -1,2 +0,2 @@ | ||
(function(f,c){typeof exports=="object"&&typeof module!="undefined"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(f=typeof globalThis!="undefined"?globalThis:f||self,c(f["@theconcurrent/utility"]={}))})(this,function(f){"use strict";function c(e,t,r){return e.find(n=>n[t]===r)}function h(e,t){return e.filter(r=>t in r)}function g(e,t,r){return e.sort((n,i)=>{const u=t.indexOf(String(n[r])),l=t.indexOf(String(i[r]));return u===-1?1:l===-1?-1:u-l})}function d(e,t){return c(e,"typeName",t)}function s(e,t,r){var o;const n=d(e,t);if(!n||n.kind!=="Object"||!n.fields)return;if(r.length===0)return n;const[i,...u]=r,l=(o=n.fields.find(v=>v.name===i))==null?void 0:o.typeName;if(l)return s(e,l,u)}function a(e,t,r,n=[],i){if(i<0)return;const u=d(e,t);if(!(!u||n.includes(t))&&(n.push(t),!(u.kind!=="Object"||!u.fields)))for(const l of u.fields){if(l.typeName===r)return l.name;const o=a(e,l.typeName,r,n,i-1);if(o)return`${l.name}.${o}`}}function m(e,t,r,n){const i=a(e,t,r,[],0);if(i)return`${n}${i}`}function A(e,t){const r=t.split(".");if(r[0]!==e.name)return null;let n=e;for(const i of r.slice(1)){if(!n||!n.fields)return null;const u=n.fields.find(l=>l.name===i);if(!u)return null;n=u}return n}function B(e,t){const r=t.split(".");let n=e;return r.forEach(i=>{typeof n=="object"&&n!==null&&i in n?n=n[i]:n=null}),n}function y(e,t,r,n){if(n.length===0)return null;const i=n[0];if(e[r]===i){if(n.length===1)return e;const u=e[t];if(Array.isArray(u))return u.reduce((l,o)=>l||y(o,t,r,n.slice(1)),null)}return null}function P(e,t,r,n){const i=n.split(".");return e.reduce((u,l)=>u||y(l,t,r,i),null)}function p(e){return e.charAt(0).toLowerCase()+e.slice(1)}f.findEntityFromPath=s,f.findInArray=P,f.findPathToEntity=a,f.findValue=B,f.generatePath=m,f.getEntityByName=d,f.getField=A,f.getItemByKeyAndValue=c,f.getItemsByHavingKey=h,f.lowercaseFirstLetter=p,f.sortDataByOrder=g,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})}); | ||
(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"})}); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -5,5 +5,7 @@ import { getItemByKeyAndValue, getItemsByHavingKey, sortDataByOrder } from './dictionaryArray'; | ||
import { findInArray, findValue } from './finder'; | ||
import { checkIsEnum, checkIsList, checkIsScalar } from './graphql'; | ||
import lowercaseFirstLetter from './lowercaseFirstLetter'; | ||
export { findInArray, findValue }; | ||
export { findEntityFromPath, findPathToEntity, generatePath, getEntityByName, getField, getItemByKeyAndValue, getItemsByHavingKey, lowercaseFirstLetter, sortDataByOrder, }; | ||
export { checkIsEnum, checkIsList, checkIsScalar }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,93 +0,94 @@ | ||
function a(r, t, e) { | ||
return r.find((n) => n[t] === e); | ||
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); | ||
} | ||
function p(r, t) { | ||
return r.filter((e) => t in e); | ||
function g(n, r) { | ||
return n.filter((e) => r in e); | ||
} | ||
function h(r, t, e) { | ||
return r.sort((n, i) => { | ||
const u = t.indexOf(String(n[e])), f = t.indexOf(String(i[e])); | ||
return u === -1 ? 1 : f === -1 ? -1 : u - f; | ||
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 l(r, t) { | ||
return a(r, "typeName", t); | ||
function l(n, r) { | ||
return h(n, "typeName", r); | ||
} | ||
function y(r, t, e) { | ||
var o; | ||
const n = l(r, t); | ||
if (!n || n.kind !== "Object" || !n.fields) | ||
function m(n, r, e) { | ||
var f; | ||
const t = l(n, r); | ||
if (!t || t.kind !== "Object" || !t.fields) | ||
return; | ||
if (e.length === 0) | ||
return n; | ||
const [i, ...u] = e, f = (o = n.fields.find( | ||
(d) => d.name === i | ||
)) == null ? void 0 : o.typeName; | ||
if (f) | ||
return y(r, f, u); | ||
return t; | ||
const [u, ...i] = e, o = (f = t.fields.find( | ||
(T) => T.name === u | ||
)) == null ? void 0 : f.typeName; | ||
if (o) | ||
return m(n, o, i); | ||
} | ||
function c(r, t, e, n = [], i) { | ||
if (i < 0) | ||
function a(n, r, e, t = [], u) { | ||
if (u < 0) | ||
return; | ||
const u = l(r, t); | ||
if (!(!u || n.includes(t)) && (n.push(t), !(u.kind !== "Object" || !u.fields))) | ||
for (const f of u.fields) { | ||
if (f.typeName === e) | ||
return f.name; | ||
const o = c( | ||
r, | ||
f.typeName, | ||
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) | ||
return o.name; | ||
const f = a( | ||
n, | ||
o.typeName, | ||
e, | ||
n, | ||
i - 1 | ||
t, | ||
u - 1 | ||
); | ||
if (o) | ||
return `${f.name}.${o}`; | ||
if (f) | ||
return `${o.name}.${f}`; | ||
} | ||
} | ||
function A(r, t, e, n) { | ||
const i = c(r, t, e, [], 0); | ||
if (i) | ||
return `${n}${i}`; | ||
function x(n, r, e, t) { | ||
const u = a(n, r, e, [], 0); | ||
if (u) | ||
return `${t}${u}`; | ||
} | ||
function g(r, t) { | ||
const e = t.split("."); | ||
if (e[0] !== r.name) | ||
function B(n, r) { | ||
const e = r.split("."); | ||
if (e[0] !== n.name) | ||
return null; | ||
let n = r; | ||
for (const i of e.slice(1)) { | ||
if (!n || !n.fields) | ||
let t = n; | ||
for (const u of e.slice(1)) { | ||
if (!t || !t.fields) | ||
return null; | ||
const u = n.fields.find((f) => f.name === i); | ||
if (!u) | ||
const i = t.fields.find((o) => o.name === u); | ||
if (!i) | ||
return null; | ||
n = u; | ||
t = i; | ||
} | ||
return n; | ||
return t; | ||
} | ||
function m(r, t) { | ||
const e = t.split("."); | ||
let n = r; | ||
return e.forEach((i) => { | ||
typeof n == "object" && n !== null && i in n ? n = n[i] : n = null; | ||
}), 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 s(r, t, e, n) { | ||
if (n.length === 0) | ||
function d(n, r, e, t) { | ||
if (t.length === 0) | ||
return null; | ||
const i = n[0]; | ||
if (r[e] === i) { | ||
if (n.length === 1) | ||
return r; | ||
const u = r[t]; | ||
if (Array.isArray(u)) | ||
return u.reduce( | ||
(f, o) => ( | ||
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 | ||
f || s( | ||
o || d( | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
o, | ||
t, | ||
f, | ||
r, | ||
e, | ||
n.slice(1) | ||
t.slice(1) | ||
) | ||
@@ -100,25 +101,37 @@ ), | ||
} | ||
function v(r, t, e, n) { | ||
const i = n.split("."); | ||
return r.reduce( | ||
(u, f) => u || s(f, t, e, i), | ||
function N(n, r, e, t) { | ||
const u = t.split("."); | ||
return n.reduce( | ||
(i, o) => i || d(o, r, e, u), | ||
null | ||
); | ||
} | ||
function x(r) { | ||
return r.charAt(0).toLowerCase() + r.slice(1); | ||
function P(n) { | ||
return p(n.type) || y(n.type) && p(n.type.ofType); | ||
} | ||
function O(n) { | ||
return s(n.type) || y(n.type) && s(n.type.ofType); | ||
} | ||
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 { | ||
y as findEntityFromPath, | ||
v as findInArray, | ||
c as findPathToEntity, | ||
m as findValue, | ||
A as generatePath, | ||
P as checkIsEnum, | ||
O as checkIsList, | ||
E as checkIsScalar, | ||
m as findEntityFromPath, | ||
N as findInArray, | ||
a as findPathToEntity, | ||
I as findValue, | ||
x as generatePath, | ||
l as getEntityByName, | ||
g as getField, | ||
a as getItemByKeyAndValue, | ||
p as getItemsByHavingKey, | ||
x as lowercaseFirstLetter, | ||
h as sortDataByOrder | ||
B as getField, | ||
h as getItemByKeyAndValue, | ||
g as getItemsByHavingKey, | ||
L as lowercaseFirstLetter, | ||
v as sortDataByOrder | ||
}; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1,2 +0,2 @@ | ||
(function(f,c){typeof exports=="object"&&typeof module!="undefined"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(f=typeof globalThis!="undefined"?globalThis:f||self,c(f["@theconcurrent/utility"]={}))})(this,function(f){"use strict";function c(e,t,r){return e.find(n=>n[t]===r)}function h(e,t){return e.filter(r=>t in r)}function g(e,t,r){return e.sort((n,i)=>{const u=t.indexOf(String(n[r])),l=t.indexOf(String(i[r]));return u===-1?1:l===-1?-1:u-l})}function d(e,t){return c(e,"typeName",t)}function s(e,t,r){var o;const n=d(e,t);if(!n||n.kind!=="Object"||!n.fields)return;if(r.length===0)return n;const[i,...u]=r,l=(o=n.fields.find(v=>v.name===i))==null?void 0:o.typeName;if(l)return s(e,l,u)}function a(e,t,r,n=[],i){if(i<0)return;const u=d(e,t);if(!(!u||n.includes(t))&&(n.push(t),!(u.kind!=="Object"||!u.fields)))for(const l of u.fields){if(l.typeName===r)return l.name;const o=a(e,l.typeName,r,n,i-1);if(o)return`${l.name}.${o}`}}function m(e,t,r,n){const i=a(e,t,r,[],0);if(i)return`${n}${i}`}function A(e,t){const r=t.split(".");if(r[0]!==e.name)return null;let n=e;for(const i of r.slice(1)){if(!n||!n.fields)return null;const u=n.fields.find(l=>l.name===i);if(!u)return null;n=u}return n}function B(e,t){const r=t.split(".");let n=e;return r.forEach(i=>{typeof n=="object"&&n!==null&&i in n?n=n[i]:n=null}),n}function y(e,t,r,n){if(n.length===0)return null;const i=n[0];if(e[r]===i){if(n.length===1)return e;const u=e[t];if(Array.isArray(u))return u.reduce((l,o)=>l||y(o,t,r,n.slice(1)),null)}return null}function P(e,t,r,n){const i=n.split(".");return e.reduce((u,l)=>u||y(l,t,r,i),null)}function p(e){return e.charAt(0).toLowerCase()+e.slice(1)}f.findEntityFromPath=s,f.findInArray=P,f.findPathToEntity=a,f.findValue=B,f.generatePath=m,f.getEntityByName=d,f.getField=A,f.getItemByKeyAndValue=c,f.getItemsByHavingKey=h,f.lowercaseFirstLetter=p,f.sortDataByOrder=g,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})}); | ||
(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"})}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@theconcurrent/utility", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"main": "./dist/index.umd.js", | ||
@@ -29,3 +29,3 @@ "module": "./dist/index.es.js", | ||
}, | ||
"gitHead": "0be5547c52194a6f3163980362213f38446db02f" | ||
"gitHead": "65f44097b9fb1d2ec36c92b8d530db725aa71f52" | ||
} |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
44610
42
250
4