zhi-common
Advanced tools
Comparing version 1.6.2 to 1.8.0
import ZhiCommon from "./lib/zhi-common"; | ||
import ZhiUtil from "./lib/ZhiUtil"; | ||
import DateUtil from "./lib/dateUtil"; | ||
import HtmlUtil from "./lib/htmlUtil"; | ||
import JsonUtil from "./lib/jsonUtil"; | ||
import StrUtil from "./lib/strUtil"; | ||
import ObjectUtil from "./lib/objectUtil"; | ||
export { ZhiCommon }; | ||
export { ZhiUtil }; | ||
export { DateUtil, HtmlUtil, JsonUtil, StrUtil, ObjectUtil }; |
@@ -9,3 +9,3 @@ /** | ||
declare class DateUtil { | ||
private readonly TIME_SPLIT; | ||
private static readonly TIME_SPLIT; | ||
/** | ||
@@ -19,3 +19,3 @@ * 给日期添加小时 | ||
*/ | ||
private addHoursToDate; | ||
private static addHoursToDate; | ||
/** | ||
@@ -30,3 +30,3 @@ * 转换ISO日期为中文日期的通用转换方法 | ||
*/ | ||
private formatIsoToZhDateFormat; | ||
private static formatIsoToZhDateFormat; | ||
/** | ||
@@ -37,3 +37,3 @@ * 转换ISO日期为中文完整时间 | ||
*/ | ||
formatIsoToZh(str: string): string; | ||
static formatIsoToZh(str: string): string; | ||
/** | ||
@@ -44,3 +44,3 @@ * 转换ISO日期为中文日期 | ||
*/ | ||
formatIsoToZhDate(str: string): string; | ||
static formatIsoToZhDate(str: string): string; | ||
/** | ||
@@ -51,20 +51,20 @@ * 转换ISO日期为中文时间 | ||
*/ | ||
formatIsoToZhTime(str: string): string; | ||
static formatIsoToZhTime(str: string): string; | ||
/** | ||
* 当前日期时间完整格式,格式:2023-03-10 02:03:43 | ||
*/ | ||
nowZh(): string; | ||
static nowZh(): string; | ||
/** | ||
* 当前日期,格式:2023-03-10 | ||
*/ | ||
nowDateZh(): string; | ||
static nowDateZh(): string; | ||
/** | ||
* 当前时间,格式:02:03:43 | ||
*/ | ||
nowTimeZh(): string; | ||
static nowTimeZh(): string; | ||
/** | ||
* 当前年份 | ||
*/ | ||
nowYear(): number; | ||
static nowYear(): number; | ||
} | ||
export default DateUtil; |
@@ -5,4 +5,2 @@ /** | ||
declare class HtmlUtil { | ||
private readonly mdUtil; | ||
constructor(); | ||
/** | ||
@@ -13,3 +11,3 @@ * 移除标题数字 | ||
*/ | ||
removeTitleNumber(str: string): string; | ||
static removeTitleNumber(str: string): string; | ||
/** | ||
@@ -20,3 +18,3 @@ * 删除挂件的HTML | ||
*/ | ||
removeWidgetTag(str: string): string; | ||
static removeWidgetTag(str: string): string; | ||
/** | ||
@@ -27,3 +25,3 @@ * 删除Markdown文本的挂件的HTML | ||
*/ | ||
removeMdWidgetTag(str: string): string; | ||
static removeMdWidgetTag(str: string): string; | ||
/** | ||
@@ -34,3 +32,3 @@ * 去除html标签,残缺不全也可以 | ||
*/ | ||
filterHtml(str: string): string; | ||
static filterHtml(str: string): string; | ||
/** | ||
@@ -43,16 +41,4 @@ * 截取指定长度html | ||
*/ | ||
parseHtml(html: string, length: number, ignore?: boolean): string; | ||
static parseHtml(html: string, length: number, ignore?: boolean): string; | ||
/** | ||
* 将Markdown转换为HTML | ||
* | ||
* @param md - Markdown | ||
*/ | ||
mdToHtml(md: string): Promise<string>; | ||
/** | ||
* 将Markdown转换为纯文本 | ||
* | ||
* @param md - Markdown | ||
*/ | ||
mdToPlainText(md: string): Promise<string>; | ||
/** | ||
* 移除H1标签 | ||
@@ -62,3 +48,3 @@ * | ||
*/ | ||
removeH1(html: string): string; | ||
static removeH1(html: string): string; | ||
/** | ||
@@ -78,4 +64,4 @@ * 移除Markdown里面的H1标签 | ||
*/ | ||
removeMdH1(md: string): string; | ||
static removeMdH1(md: string): string; | ||
} | ||
export default HtmlUtil; |
@@ -1,2 +0,1 @@ | ||
import { JSONSchemaType } from "ajv"; | ||
/** | ||
@@ -10,13 +9,10 @@ * 校验 JSON schema | ||
declare class JsonUtil { | ||
private ajv; | ||
constructor(); | ||
validateJson<T>(schema: JSONSchemaType<T>, data: T): { | ||
valid: boolean; | ||
error?: string; | ||
}; | ||
validateObjectSchema(schemaObject: object, dataObject: object): { | ||
valid: boolean; | ||
error?: string; | ||
}; | ||
/** | ||
* 安全的解析json | ||
* | ||
* @param str json字符串 | ||
* @param def 默认值 | ||
*/ | ||
static safeParse<T>(str: string, def: T): T; | ||
} | ||
export default JsonUtil; |
@@ -14,4 +14,4 @@ /** | ||
*/ | ||
isEmptyObject(obj: any): boolean; | ||
static isEmptyObject(obj: any): boolean; | ||
} | ||
export default ObjectUtil; |
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
f(str: string, ...args: (string | number | boolean | object)[]): string; | ||
static f(str: string, ...args: (string | number | boolean | object)[]): string; | ||
/** | ||
@@ -24,3 +24,3 @@ * 字符串拼接 | ||
*/ | ||
appendStr(...str: string[]): string; | ||
static appendStr(...str: string[]): string; | ||
/** | ||
@@ -32,3 +32,3 @@ * 判断字符串中,是否包含数组中任何一个元素 | ||
*/ | ||
includeInArray(str: string, arr: string[]): boolean; | ||
static includeInArray(str: string, arr: string[]): boolean; | ||
/** | ||
@@ -41,3 +41,3 @@ * 截取指定长度的字符串 | ||
*/ | ||
getByLength(str: string, length: number, ignore?: boolean): string; | ||
static getByLength(str: string, length: number, ignore?: boolean): string; | ||
/** | ||
@@ -48,3 +48,3 @@ * 字符串空值检测 | ||
*/ | ||
isEmptyString(str: any): boolean; | ||
static isEmptyString(str: any): boolean; | ||
/** | ||
@@ -56,3 +56,3 @@ * 路径组合,解决多出来/的问题 | ||
*/ | ||
pathJoin(path1: string, path2: string): string; | ||
static pathJoin(path1: string, path2: string): string; | ||
/** | ||
@@ -63,4 +63,4 @@ * 强转boolean | ||
*/ | ||
parseBoolean(val: any): boolean; | ||
static parseBoolean(val: any): boolean; | ||
} | ||
export default StrUtil; |
import JsonUtil from "./jsonUtil"; | ||
import DateUtil from "./dateUtil"; | ||
import StrUtil from "./strUtil"; | ||
import VersionUtil from "./versionUtil"; | ||
import HtmlUtil from "./htmlUtil"; | ||
import MarkdownUtil from "./markdownUtil"; | ||
import ObjectUtil from "./objectUtil"; | ||
@@ -16,11 +14,8 @@ /** | ||
declare class ZhiCommon { | ||
readonly dateUtil: DateUtil; | ||
readonly strUtil: StrUtil; | ||
readonly versionUtil: VersionUtil; | ||
readonly htmlUtil: HtmlUtil; | ||
readonly markdownUtil: MarkdownUtil; | ||
readonly jsonUtil: JsonUtil; | ||
readonly objectUtil: ObjectUtil; | ||
constructor(); | ||
static readonly dateUtil: typeof DateUtil; | ||
static readonly strUtil: typeof StrUtil; | ||
static readonly htmlUtil: typeof HtmlUtil; | ||
static readonly jsonUtil: typeof JsonUtil; | ||
static readonly objectUtil: typeof ObjectUtil; | ||
} | ||
export default ZhiCommon; |
{ | ||
"name": "zhi-common", | ||
"version": "1.6.2", | ||
"version": "1.8.0", | ||
"type": "module", | ||
@@ -30,13 +30,4 @@ "description": "a collection of util tools", | ||
"@terwer/tsconfig": "workspace:*", | ||
"@terwer/vite-config-custom": "workspace:*", | ||
"@types/showdown": "^2.0.1" | ||
}, | ||
"dependencies": { | ||
"ajv": "^8.12.0", | ||
"compare-versions": "5.0.3", | ||
"showdown": "^2.1.0", | ||
"zhi-device": "workspace:*", | ||
"zhi-env": "workspace:*", | ||
"zhi-log": "workspace:*" | ||
"@terwer/vite-config-custom": "workspace:*" | ||
} | ||
} |
@@ -18,9 +18,3 @@ # zhi-common | ||
``` | ||
├── zhi-device | ||
├── zhi-env | ||
├── zhi-log | ||
├── lute | ||
├── showdown | ||
├── compare-versions | ||
├── ajv | ||
## Congregations! zhi-env need no deps, it is just pure js code 🎉 | ||
``` | ||
@@ -27,0 +21,0 @@ |
{ | ||
"name": "zhi-common", | ||
"version": "1.6.2", | ||
"version": "1.8.0", | ||
"type": "module", | ||
@@ -21,15 +21,6 @@ "description": "a collection of util tools", | ||
"devDependencies": { | ||
"@types/showdown": "^2.0.1", | ||
"@terwer/eslint-config-custom": "1.2.0", | ||
"@terwer/tsconfig": "1.0.0", | ||
"@terwer/vite-config-custom": "0.6.0" | ||
"@terwer/vite-config-custom": "0.6.3", | ||
"@terwer/tsconfig": "1.0.0" | ||
}, | ||
"dependencies": { | ||
"ajv": "^8.12.0", | ||
"compare-versions": "5.0.3", | ||
"showdown": "^2.1.0", | ||
"zhi-device": "0.7.3", | ||
"zhi-env": "1.17.2", | ||
"zhi-log": "1.13.3" | ||
}, | ||
"scripts": { | ||
@@ -36,0 +27,0 @@ "serve": "vite", |
@@ -18,9 +18,3 @@ # zhi-common | ||
``` | ||
├── zhi-device | ||
├── zhi-env | ||
├── zhi-log | ||
├── lute | ||
├── showdown | ||
├── compare-versions | ||
├── ajv | ||
## Congregations! zhi-env need no deps, it is just pure js code 🎉 | ||
``` | ||
@@ -27,0 +21,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
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
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
0
3
1
1
24605
13
827
45
- Removedajv@^8.12.0
- Removedcompare-versions@5.0.3
- Removedshowdown@^2.1.0
- Removedzhi-device@0.7.3
- Removedzhi-env@1.17.2
- Removedzhi-log@1.13.3
- Removedajv@8.17.1(transitive)
- Removedansi-colors@4.1.3(transitive)
- Removedcallsites@4.2.0(transitive)
- Removedcommander@9.5.0(transitive)
- Removedcompare-versions@5.0.3(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-uri@3.0.3(transitive)
- Removedjson-schema-traverse@1.0.0(transitive)
- Removedkleur@4.1.5(transitive)
- Removedloglevel@1.9.2(transitive)
- Removedloglevel-plugin-prefix@0.8.4(transitive)
- Removedrequire-from-string@2.0.2(transitive)
- Removedshowdown@2.1.0(transitive)
- Removedzhi-device@0.7.3(transitive)
- Removedzhi-env@1.17.2(transitive)
- Removedzhi-log@1.13.3(transitive)