@tikkhun/utils-core
Advanced tools
Comparing version 0.0.0 to 0.0.1
'use strict'; | ||
/** | ||
@tikkhun-utils/core | ||
@tikkhun/utils-core | ||
*/ | ||
@@ -6,0 +6,0 @@ var s="user",n="admin",o=[s,n]; |
'use strict'; | ||
/** | ||
@tikkhun-utils/core | ||
@tikkhun/utils-core | ||
*/ | ||
@@ -6,0 +6,0 @@ function s(n,e){return Object.values(e).includes(n)} |
'use strict'; | ||
/** | ||
@tikkhun-utils/core | ||
@tikkhun/utils-core | ||
*/ | ||
@@ -6,0 +6,0 @@ function e(r){return {status:"success",code:void 0,error:"",data:r}}function s(r){return {status:"error",code:void 0,error:r.message,data:null}} |
@@ -10,5 +10,5 @@ 'use strict'; | ||
/** | ||
@tikkhun-utils/core | ||
@tikkhun/utils-core | ||
*/ | ||
var d=Object.defineProperty,T=Object.defineProperties;var O=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var m=(t,e,r)=>e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f=(t,e)=>{for(var r in e||(e={}))L.call(e,r)&&m(t,r,e[r]);if(l)for(var r of l(e))y.call(e,r)&&m(t,r,e[r]);return t},a=(t,e)=>T(t,O(e));var g=(t,e,r)=>new Promise((n,o)=>{var i=p=>{try{s(r.next(p));}catch(u){o(u);}},c=p=>{try{s(r.throw(p));}catch(u){o(u);}},s=p=>p.done?n(p.value):Promise.resolve(p.value).then(i,c);s((r=r.apply(t,e)).next());});var h="user",j="admin",B=[h,j];function U(t,e){return Object.values(e).includes(t)}function R(t){return {status:"success",code:void 0,error:"",data:t}}function $(t){return {status:"error",code:void 0,error:t.message,data:null}}var I={delimiter:".",list:[],keyItemTransformer:function(t){return t}};function k(t){let{delimiter:e,keyItemTransformer:r,list:n}=Object.assign(I,t),o={};return n.forEach(({key:i,value:c})=>{P.set(o,i.split(e).map(r).join("."),c);}),o}var C={delimiter:".",json:{}};function J(t){let{delimiter:e,json:r,prefix:n}=Object.assign(C,t);return Object.keys(r).reduce((o,i)=>{let c=n?`${n}${e}${i}`:i;if(typeof r[i]=="object"&&r[i]!==null){let s=J(a(f({},t),{json:r[i],prefix:c}));if(s&&s.length)return o.concat(s)}else return o.concat({key:c,value:r[i]});return o},[])}var{get:w}=P__default.default;function D(t,e=""){return e?w(t,e):t}function F(t){return JSON.parse(JSON.stringify(t))}function G(t){for(let e in t)if(t.hasOwnProperty(e))return !1;return !0}function V(t){return t?t.constructor===Object:!1}var E={limit:0,offset:0};function q(t){let{limit:e,offset:r}=Object.assign({},E,t),n=e>0?e:0,o=r>=0?Math.floor(r/n)+1:0;return {pageSize:n,pageNo:o}}var x=["B","KB","MB","GB","TB","PB"];function Q(t){let e=0;for(;t>=1024&&e<x.length-1;)t/=1024,e++;return `${t.toFixed(2)} ${x[e]}`}function X(t=""){if(typeof t!="string")throw new Error("str is not string");let[e,...r]=t;return e?e.toUpperCase()+r.join(""):""}function Y(t=""){return t.replace(/[-\s]/g,"_").replace(/[A-Z]/g,e=>`_${e}`).toUpperCase()}function tt(t){return t=t.replace(/[-_](\w)/g,(e,r)=>r.toUpperCase()),t.replace(/^\w/,e=>e.toUpperCase())}function et(t){return t=t.replace(/[-_](\w)/g,(e,r)=>r.toUpperCase()),t.charAt(0).toLowerCase()+t.slice(1)}function nt(t){return g(this,null,function*(){return yield new Promise(e=>{setTimeout(e,t);})})}function st(t){let e=[],r={};return t.forEach(n=>{r[n.id]=a(f({},n),{children:[]});}),t.forEach(n=>{if(!n.parentId)return;let o=r[n.parentId];o?(o.children||(o.children=[]),o.children.push(r[n.id])):e.push(r[n.id]);}),e}function ft(t){return t.match(/^(\d)\./)} | ||
var x=Object.defineProperty,T=Object.defineProperties;var O=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;var m=(t,e,r)=>e in t?x(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f=(t,e)=>{for(var r in e||(e={}))y.call(e,r)&&m(t,r,e[r]);if(l)for(var r of l(e))L.call(e,r)&&m(t,r,e[r]);return t},u=(t,e)=>T(t,O(e));var g=(t,e,r)=>new Promise((n,o)=>{var i=c=>{try{s(r.next(c));}catch(a){o(a);}},p=c=>{try{s(r.throw(c));}catch(a){o(a);}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(i,p);s((r=r.apply(t,e)).next());});var h="user",j="admin",B=[h,j];function U(t,e){return Object.values(e).includes(t)}function v(t){return {status:"success",code:void 0,error:"",data:t}}function R(t){return {status:"error",code:void 0,error:t.message,data:null}}var b={delimiter:".",list:[],isKeyInclude:()=>!0,keyItemTransformer:function(t){return t}};function M(t){let{delimiter:e,keyItemTransformer:r,list:n,isKeyInclude:o}=Object.assign(b,t),i={};return n.forEach(({key:p,value:s})=>{o(p)&&P.set(i,p.split(e).map(r).join("."),s);}),i}var C={delimiter:".",json:{}};function J(t){let{delimiter:e,json:r,prefix:n}=Object.assign(C,t);return Object.keys(r).reduce((o,i)=>{let p=n?`${n}${e}${i}`:i;if(typeof r[i]=="object"&&r[i]!==null){let s=J(u(f({},t),{json:r[i],prefix:p}));if(s&&s.length)return o.concat(s)}else return o.concat({key:p,value:r[i]});return o},[])}var{get:w}=P__default.default;function D(t,e=""){return e?w(t,e):t}function F(t){return JSON.parse(JSON.stringify(t))}function G(t){for(let e in t)if(t.hasOwnProperty(e))return !1;return !0}function V(t){return t?t.constructor===Object:!1}var E={limit:0,offset:0};function q(t){let{limit:e,offset:r}=Object.assign({},E,t),n=e>0?e:0,o=r>=0?Math.floor(r/n)+1:0;return {pageSize:n,pageNo:o}}var d=["B","KB","MB","GB","TB","PB"];function Q(t){let e=0;for(;t>=1024&&e<d.length-1;)t/=1024,e++;return `${t.toFixed(2)} ${d[e]}`}function X(t=""){if(typeof t!="string")throw new Error("str is not string");let[e,...r]=t;return e?e.toUpperCase()+r.join(""):""}function Y(t=""){return t.replace(/[-\s]/g,"_").replace(/[A-Z]/g,e=>`_${e}`).toUpperCase()}function tt(t){return t=t.replace(/[-_](\w)/g,(e,r)=>r.toUpperCase()),t.replace(/^\w/,e=>e.toUpperCase())}function et(t){return t=t.replace(/[-_](\w)/g,(e,r)=>r.toUpperCase()),t.charAt(0).toLowerCase()+t.slice(1)}function nt(t){return g(this,null,function*(){return yield new Promise(e=>{setTimeout(e,t);})})}function st(t){let e=[],r={};return t.forEach(n=>{r[n.id]=u(f({},n),{children:[]});}),t.forEach(n=>{if(!n.parentId)return;let o=r[n.parentId];o?(o.children||(o.children=[]),o.children.push(r[n.id])):e.push(r[n.id]);}),e}function ft(t){return t.match(/^(\d)\./)} | ||
@@ -19,8 +19,8 @@ exports.ROLES = B; | ||
exports.defaultJsonToListOptions = C; | ||
exports.defaultListToJsonOptions = I; | ||
exports.defaultListToJsonOptions = b; | ||
exports.formatSizeUnits = Q; | ||
exports.getByPath = D; | ||
exports.getError = $; | ||
exports.getError = R; | ||
exports.getMajorVersion = ft; | ||
exports.getSuccess = R; | ||
exports.getSuccess = v; | ||
exports.isEmptyObj = G; | ||
@@ -32,3 +32,3 @@ exports.isPlainObject = V; | ||
exports.limitOffsetToPage = q; | ||
exports.listToJson = k; | ||
exports.listToJson = M; | ||
exports.sleep = nt; | ||
@@ -35,0 +35,0 @@ exports.toBigCamelCase = tt; |
@@ -8,2 +8,3 @@ interface ListItem { | ||
list: ListItem[]; | ||
isKeyInclude(v: string): boolean; | ||
/** | ||
@@ -10,0 +11,0 @@ * 比如将 keyItem 转小写等 |
@@ -6,9 +6,9 @@ 'use strict'; | ||
/** | ||
@tikkhun-utils/core | ||
@tikkhun/utils-core | ||
*/ | ||
var m=Object.defineProperty,u=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var g=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var c=(s,n,t)=>n in s?m(s,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[n]=t,l=(s,n)=>{for(var t in n||(n={}))g.call(n,t)&&c(s,t,n[t]);if(a)for(var t of a(n))T.call(n,t)&&c(s,t,n[t]);return s},f=(s,n)=>u(s,L(n));var d={delimiter:".",list:[],keyItemTransformer:function(s){return s}};function y(s){let{delimiter:n,keyItemTransformer:t,list:e}=Object.assign(d,s),o={};return e.forEach(({key:i,value:r})=>{lodash.set(o,i.split(n).map(t).join("."),r);}),o}var j={delimiter:".",json:{}};function x(s){let{delimiter:n,json:t,prefix:e}=Object.assign(j,s);return Object.keys(t).reduce((o,i)=>{let r=e?`${e}${n}${i}`:i;if(typeof t[i]=="object"&&t[i]!==null){let p=x(f(l({},s),{json:t[i],prefix:r}));if(p&&p.length)return o.concat(p)}else return o.concat({key:r,value:t[i]});return o},[])} | ||
var f=Object.defineProperty,m=Object.defineProperties;var g=Object.getOwnPropertyDescriptors;var c=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable;var p=(s,n,t)=>n in s?f(s,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[n]=t,a=(s,n)=>{for(var t in n||(n={}))L.call(n,t)&&p(s,t,n[t]);if(c)for(var t of c(n))d.call(n,t)&&p(s,t,n[t]);return s},u=(s,n)=>m(s,g(n));var O={delimiter:".",list:[],isKeyInclude:()=>!0,keyItemTransformer:function(s){return s}};function y(s){let{delimiter:n,keyItemTransformer:t,list:l,isKeyInclude:e}=Object.assign(O,s),i={};return l.forEach(({key:o,value:r})=>{e(o)&&lodash.set(i,o.split(n).map(t).join("."),r);}),i}var j={delimiter:".",json:{}};function x(s){let{delimiter:n,json:t,prefix:l}=Object.assign(j,s);return Object.keys(t).reduce((e,i)=>{let o=l?`${l}${n}${i}`:i;if(typeof t[i]=="object"&&t[i]!==null){let r=x(u(a({},s),{json:t[i],prefix:o}));if(r&&r.length)return e.concat(r)}else return e.concat({key:o,value:t[i]});return e},[])} | ||
exports.defaultJsonToListOptions = j; | ||
exports.defaultListToJsonOptions = d; | ||
exports.defaultListToJsonOptions = O; | ||
exports.jsonToList = x; | ||
exports.listToJson = y; |
@@ -10,3 +10,3 @@ 'use strict'; | ||
/** | ||
@tikkhun-utils/core | ||
@tikkhun/utils-core | ||
*/ | ||
@@ -13,0 +13,0 @@ var{get:e}=n__default.default;function o(r,t=""){return t?e(r,t):r}function u(r){return JSON.parse(JSON.stringify(r))}function f(r){for(let t in r)if(r.hasOwnProperty(t))return !1;return !0}function s(r){return r?r.constructor===Object:!1} |
'use strict'; | ||
/** | ||
@tikkhun-utils/core | ||
@tikkhun/utils-core | ||
*/ | ||
@@ -6,0 +6,0 @@ var s={limit:0,offset:0};function n(o){let{limit:t,offset:e}=Object.assign({},s,o),i=t>0?t:0,f=e>=0?Math.floor(e/i)+1:0;return {pageSize:i,pageNo:f}} |
'use strict'; | ||
/** | ||
@tikkhun-utils/core | ||
@tikkhun/utils-core | ||
*/ | ||
@@ -6,0 +6,0 @@ var e=["B","KB","MB","GB","TB","PB"];function B(t){let n=0;for(;t>=1024&&n<e.length-1;)t/=1024,n++;return `${t.toFixed(2)} ${e[n]}`} |
'use strict'; | ||
/** | ||
@tikkhun-utils/core | ||
@tikkhun/utils-core | ||
*/ | ||
@@ -6,0 +6,0 @@ function o(e=""){if(typeof e!="string")throw new Error("str is not string");let[r,...t]=e;return r?r.toUpperCase()+t.join(""):""}function n(e=""){return e.replace(/[-\s]/g,"_").replace(/[A-Z]/g,r=>`_${r}`).toUpperCase()}function p(e){return e=e.replace(/[-_](\w)/g,(r,t)=>t.toUpperCase()),e.replace(/^\w/,r=>r.toUpperCase())}function a(e){return e=e.replace(/[-_](\w)/g,(r,t)=>t.toUpperCase()),e.charAt(0).toLowerCase()+e.slice(1)} |
'use strict'; | ||
/** | ||
@tikkhun-utils/core | ||
@tikkhun/utils-core | ||
*/ | ||
@@ -6,0 +6,0 @@ var u=(t,r,n)=>new Promise((a,s)=>{var m=e=>{try{i(n.next(e));}catch(o){s(o);}},c=e=>{try{i(n.throw(e));}catch(o){s(o);}},i=e=>e.done?a(e.value):Promise.resolve(e.value).then(m,c);i((n=n.apply(t,r)).next());});function w(t){return u(this,null,function*(){return yield new Promise(r=>{setTimeout(r,t);})})} |
'use strict'; | ||
/** | ||
@tikkhun-utils/core | ||
@tikkhun/utils-core | ||
*/ | ||
@@ -6,0 +6,0 @@ var o=Object.defineProperty,h=Object.defineProperties;var l=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var a=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;var c=(i,e,r)=>e in i?o(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,p=(i,e)=>{for(var r in e||(e={}))a.call(e,r)&&c(i,r,e[r]);if(d)for(var r of d(e))f.call(e,r)&&c(i,r,e[r]);return i},s=(i,e)=>h(i,l(e));function T(i){let e=[],r={};return i.forEach(n=>{r[n.id]=s(p({},n),{children:[]});}),i.forEach(n=>{if(!n.parentId)return;let t=r[n.parentId];t?(t.children||(t.children=[]),t.children.push(r[n.id])):e.push(r[n.id]);}),e} |
'use strict'; | ||
/** | ||
@tikkhun-utils/core | ||
@tikkhun/utils-core | ||
*/ | ||
@@ -6,0 +6,0 @@ function t(r){return r.match(/^(\d)\./)} |
{ | ||
"name": "@tikkhun/utils-core", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
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
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
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26182
371