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

zhi-common

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zhi-common - npm Package Compare versions

Comparing version 1.8.1 to 1.8.2

84

./dist/index.js

@@ -1,5 +0,5 @@

var w = Object.defineProperty;
var T = (i, e, t) => e in i ? w(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
var l = (i, e, t) => (T(i, typeof e != "symbol" ? e + "" : e, t), t);
class $ {
var I = Object.defineProperty;
var D = (o, e, t) => e in o ? I(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
var l = (o, e, t) => (D(o, typeof e != "symbol" ? e + "" : e, t), t);
class m {
/**

@@ -82,25 +82,31 @@ * 格式化字符串

}
const I = (i, e, t) => {
const O = (o, e, t) => {
const r = e ?? "zhi", a = (n) => {
const o = n.getFullYear(), s = String(n.getMonth() + 1).padStart(2, "0"), g = String(n.getDate()).padStart(2, "0"), p = String(n.getHours()).padStart(2, "0"), f = String(n.getMinutes()).padStart(2, "0"), h = String(n.getSeconds()).padStart(2, "0");
return `${o}-${s}-${g} ${p}:${f}:${h}`;
}, c = (n, o, s) => {
const s = n.getFullYear(), i = String(n.getMonth() + 1).padStart(2, "0"), g = String(n.getDate()).padStart(2, "0"), h = String(n.getHours()).padStart(2, "0"), w = String(n.getMinutes()).padStart(2, "0"), T = String(n.getSeconds()).padStart(2, "0");
return `${s}-${i}-${g} ${h}:${w}:${T}`;
}, c = (n, s, i) => {
const g = a(/* @__PURE__ */ new Date());
s ? console.log(`[${r}] [${g}] [${n}] [${i}] ${o}`, s) : console.log(`[${r}] [${g}] [${n}] [${i}] ${o}`);
i ? console.log(`[${r}] [${g}] [${n}] [${o}] ${s}`, i) : console.log(`[${r}] [${g}] [${n}] [${o}] ${s}`);
}, u = (n, s) => {
const i = a(/* @__PURE__ */ new Date());
s ? console.info(`[${r}] [${i}] [INFO] [${o}] ${n}`, s) : console.info(`[${r}] [${i}] [INFO] [${o}] ${n}`);
}, p = (n, s) => {
const i = a(/* @__PURE__ */ new Date());
s ? console.warn(`[${r}] [${i}] [WARN] [${o}] ${n}`, s) : console.warn(`[${r}] [${i}] [WARN] [${o}] ${n}`);
}, f = (n, s) => {
const i = a(/* @__PURE__ */ new Date());
s ? console.error(typeof n == "string" ? `[${r}] [${i}] [ERROR] [${o}] ${n}` : `[${r}] [${i}] [ERROR] [${o}] ${n.toString()}`, s) : typeof n == "string" ? console.error(`[${r}] [${i}] [ERROR] [${o}] ${n.toString()}`) : console.error(`[${r}] [${i}] [ERROR] [${o}] an error occurred =>`, n);
};
return {
debug: (n, o) => {
t && c("DEBUG", n, o);
debug: (n, s) => {
t && c("DEBUG", n, s);
},
info: (n, o) => {
const s = a(/* @__PURE__ */ new Date());
o ? console.info(`[${r}] [${s}] [INFO] ${n}`, o) : console.info(`[${r}] [${s}] [INFO] ${n}`);
info: (n, s) => {
u(n, s);
},
warn: (n, o) => {
const s = a(/* @__PURE__ */ new Date());
o ? console.warn(`[${r}] [${s}] [WARN] ${n}`, o) : console.warn(`[${r}] [${s}] [WARN] ${n}`);
warn: (n, s) => {
p(n, s);
},
error: (n, o) => {
const s = a(/* @__PURE__ */ new Date());
o ? console.error(typeof n == "string" ? `[${r}] [${s}] [ERROR] ${n}` : `[${r}] [${s}] [ERROR] ${n.toString()}`, o) : typeof n == "string" ? console.error(`[${r}] [${s}] [ERROR] ${n.toString()}`) : console.error(`[${r}] [${s}] [ERROR] an error occurred =>`, n);
error: (n, s) => {
f(n, s);
}

@@ -118,3 +124,3 @@ };

let r;
$.isEmptyString(e) && (r = t);
m.isEmptyString(e) && (r = t);
try {

@@ -128,3 +134,3 @@ r = JSON.parse(e) || t;

}
l(d, "logger", I("json-util"));
l(d, "logger", O("json-util"));
class S {

@@ -155,12 +161,12 @@ /**

let a = e;
const c = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.\d{3})Z$/gm, n = a.match(c);
if (n == null)
const c = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.\d{3})Z$/gm, u = a.match(c);
if (u == null)
return e;
for (let o = 0; o < n.length; o++) {
const s = n[o];
let g = s;
t && (g = this.addHoursToDate(new Date(s), 8).toISOString());
const p = g.split("T"), f = p[0], h = p[1].split(".")[0];
let m = f + this.TIME_SPLIT + h;
r && (m = f), a = a.replace(s, m);
for (let p = 0; p < u.length; p++) {
const f = u[p];
let n = f;
t && (n = this.addHoursToDate(new Date(f), 8).toISOString());
const s = n.split("T"), i = s[0], g = s[1].split(".")[0];
let h = i + this.TIME_SPLIT + g;
r && (h = i), a = a.replace(f, h);
}

@@ -219,3 +225,3 @@ return a;

l(S, "TIME_SPLIT", " ");
class D {
class R {
/**

@@ -309,3 +315,3 @@ * 移除标题数字

}
class O {
class y {
/**

@@ -320,12 +326,12 @@ * 检测是否是空对象

}
class u {
class $ {
}
l(u, "dateUtil", S), l(u, "strUtil", $), l(u, "htmlUtil", D), l(u, "jsonUtil", d), l(u, "objectUtil", O);
l($, "dateUtil", S), l($, "strUtil", m), l($, "htmlUtil", R), l($, "jsonUtil", d), l($, "objectUtil", y);
export {
S as DateUtil,
D as HtmlUtil,
R as HtmlUtil,
d as JsonUtil,
O as ObjectUtil,
$ as StrUtil,
u as ZhiCommon
y as ObjectUtil,
m as StrUtil,
$ as ZhiCommon
};

@@ -1,5 +0,5 @@

var w = Object.defineProperty;
var T = (i, e, t) => e in i ? w(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
var l = (i, e, t) => (T(i, typeof e != "symbol" ? e + "" : e, t), t);
class $ {
var I = Object.defineProperty;
var D = (o, e, t) => e in o ? I(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
var l = (o, e, t) => (D(o, typeof e != "symbol" ? e + "" : e, t), t);
class m {
/**

@@ -82,25 +82,31 @@ * 格式化字符串

}
const I = (i, e, t) => {
const O = (o, e, t) => {
const r = e ?? "zhi", a = (n) => {
const o = n.getFullYear(), s = String(n.getMonth() + 1).padStart(2, "0"), g = String(n.getDate()).padStart(2, "0"), p = String(n.getHours()).padStart(2, "0"), f = String(n.getMinutes()).padStart(2, "0"), h = String(n.getSeconds()).padStart(2, "0");
return `${o}-${s}-${g} ${p}:${f}:${h}`;
}, c = (n, o, s) => {
const s = n.getFullYear(), i = String(n.getMonth() + 1).padStart(2, "0"), g = String(n.getDate()).padStart(2, "0"), h = String(n.getHours()).padStart(2, "0"), w = String(n.getMinutes()).padStart(2, "0"), T = String(n.getSeconds()).padStart(2, "0");
return `${s}-${i}-${g} ${h}:${w}:${T}`;
}, c = (n, s, i) => {
const g = a(/* @__PURE__ */ new Date());
s ? console.log(`[${r}] [${g}] [${n}] [${i}] ${o}`, s) : console.log(`[${r}] [${g}] [${n}] [${i}] ${o}`);
i ? console.log(`[${r}] [${g}] [${n}] [${o}] ${s}`, i) : console.log(`[${r}] [${g}] [${n}] [${o}] ${s}`);
}, u = (n, s) => {
const i = a(/* @__PURE__ */ new Date());
s ? console.info(`[${r}] [${i}] [INFO] [${o}] ${n}`, s) : console.info(`[${r}] [${i}] [INFO] [${o}] ${n}`);
}, p = (n, s) => {
const i = a(/* @__PURE__ */ new Date());
s ? console.warn(`[${r}] [${i}] [WARN] [${o}] ${n}`, s) : console.warn(`[${r}] [${i}] [WARN] [${o}] ${n}`);
}, f = (n, s) => {
const i = a(/* @__PURE__ */ new Date());
s ? console.error(typeof n == "string" ? `[${r}] [${i}] [ERROR] [${o}] ${n}` : `[${r}] [${i}] [ERROR] [${o}] ${n.toString()}`, s) : typeof n == "string" ? console.error(`[${r}] [${i}] [ERROR] [${o}] ${n.toString()}`) : console.error(`[${r}] [${i}] [ERROR] [${o}] an error occurred =>`, n);
};
return {
debug: (n, o) => {
t && c("DEBUG", n, o);
debug: (n, s) => {
t && c("DEBUG", n, s);
},
info: (n, o) => {
const s = a(/* @__PURE__ */ new Date());
o ? console.info(`[${r}] [${s}] [INFO] ${n}`, o) : console.info(`[${r}] [${s}] [INFO] ${n}`);
info: (n, s) => {
u(n, s);
},
warn: (n, o) => {
const s = a(/* @__PURE__ */ new Date());
o ? console.warn(`[${r}] [${s}] [WARN] ${n}`, o) : console.warn(`[${r}] [${s}] [WARN] ${n}`);
warn: (n, s) => {
p(n, s);
},
error: (n, o) => {
const s = a(/* @__PURE__ */ new Date());
o ? console.error(typeof n == "string" ? `[${r}] [${s}] [ERROR] ${n}` : `[${r}] [${s}] [ERROR] ${n.toString()}`, o) : typeof n == "string" ? console.error(`[${r}] [${s}] [ERROR] ${n.toString()}`) : console.error(`[${r}] [${s}] [ERROR] an error occurred =>`, n);
error: (n, s) => {
f(n, s);
}

@@ -118,3 +124,3 @@ };

let r;
$.isEmptyString(e) && (r = t);
m.isEmptyString(e) && (r = t);
try {

@@ -128,3 +134,3 @@ r = JSON.parse(e) || t;

}
l(d, "logger", I("json-util"));
l(d, "logger", O("json-util"));
class S {

@@ -155,12 +161,12 @@ /**

let a = e;
const c = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.\d{3})Z$/gm, n = a.match(c);
if (n == null)
const c = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.\d{3})Z$/gm, u = a.match(c);
if (u == null)
return e;
for (let o = 0; o < n.length; o++) {
const s = n[o];
let g = s;
t && (g = this.addHoursToDate(new Date(s), 8).toISOString());
const p = g.split("T"), f = p[0], h = p[1].split(".")[0];
let m = f + this.TIME_SPLIT + h;
r && (m = f), a = a.replace(s, m);
for (let p = 0; p < u.length; p++) {
const f = u[p];
let n = f;
t && (n = this.addHoursToDate(new Date(f), 8).toISOString());
const s = n.split("T"), i = s[0], g = s[1].split(".")[0];
let h = i + this.TIME_SPLIT + g;
r && (h = i), a = a.replace(f, h);
}

@@ -219,3 +225,3 @@ return a;

l(S, "TIME_SPLIT", " ");
class D {
class R {
/**

@@ -309,3 +315,3 @@ * 移除标题数字

}
class O {
class y {
/**

@@ -320,12 +326,12 @@ * 检测是否是空对象

}
class u {
class $ {
}
l(u, "dateUtil", S), l(u, "strUtil", $), l(u, "htmlUtil", D), l(u, "jsonUtil", d), l(u, "objectUtil", O);
l($, "dateUtil", S), l($, "strUtil", m), l($, "htmlUtil", R), l($, "jsonUtil", d), l($, "objectUtil", y);
export {
S as DateUtil,
D as HtmlUtil,
R as HtmlUtil,
d as JsonUtil,
O as ObjectUtil,
$ as StrUtil,
u as ZhiCommon
y as ObjectUtil,
m as StrUtil,
$ as ZhiCommon
};
{
"name": "zhi-common",
"version": "1.8.1",
"version": "1.8.2",
"type": "module",

@@ -5,0 +5,0 @@ "description": "a collection of util tools",

{
"name": "zhi-common",
"version": "1.8.1",
"version": "1.8.2",
"type": "module",

@@ -22,7 +22,7 @@ "description": "a collection of util tools",

"@terwer/eslint-config-custom": "1.2.0",
"@terwer/vite-config-custom": "0.6.3",
"@terwer/tsconfig": "1.0.0"
"@terwer/tsconfig": "1.0.0",
"@terwer/vite-config-custom": "0.6.3"
},
"dependencies": {
"zhi-lib-base": "0.0.2"
"zhi-lib-base": "0.1.0"
},

@@ -29,0 +29,0 @@ "scripts": {

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