build
This commit is contained in:
parent
4739183324
commit
c1ade4dc2a
2
lib/commons/str-utils.d.ts
vendored
2
lib/commons/str-utils.d.ts
vendored
|
|
@ -26,3 +26,5 @@ export declare function equalsIgnoreCase(source: string | undefined, target: str
|
|||
* @returns 是否包含
|
||||
*/
|
||||
export declare const includeIgnoreCase: (list: string[], search: string) => boolean;
|
||||
export declare const strLength: (str: string) => number;
|
||||
export declare const strMonospacePad: (str: string, length: number, pad?: string) => string;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -15,7 +15,7 @@
|
|||
"devDependencies": {
|
||||
"prettier": "^3.0.3",
|
||||
"typescript": "^5.0.2",
|
||||
"vite": "^4.4.5",
|
||||
"vite": "^5.1.0-beta.5",
|
||||
"vite-plugin-dts": "^3.6.3",
|
||||
"vue": "^3.2.47"
|
||||
},
|
||||
|
|
|
|||
1031
pnpm-lock.yaml
1031
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
|
@ -39,9 +39,9 @@ export function stringTokenizer<T>(
|
|||
* 如果参数都是字符串类型,则将它们转换为小写后比较。
|
||||
* 如果两个参数都是undefined,则返回true,
|
||||
* 否则返回false。
|
||||
* @param source
|
||||
* @param target
|
||||
* @returns
|
||||
* @param source
|
||||
* @param target
|
||||
* @returns
|
||||
*/
|
||||
export function equalsIgnoreCase(
|
||||
source: string | undefined,
|
||||
|
|
@ -73,3 +73,15 @@ export const includeIgnoreCase = (list: string[], search: string) => {
|
|||
return false;
|
||||
};
|
||||
|
||||
export const strLength = (str: string) => {
|
||||
return str.replaceAll(/[\u4e00-\u9fa5]/g, "--").length;
|
||||
};
|
||||
|
||||
export const strMonospacePad = (
|
||||
str: string,
|
||||
length: number,
|
||||
pad: string = " "
|
||||
) => {
|
||||
const visibleLength = length - (strLength(str) - str.length);
|
||||
return str.padEnd(visibleLength, pad);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"target": "ESNext",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"skipLibCheck": true,
|
||||
"lib": ["ES2021", "DOM", "DOM.Iterable"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user