This commit is contained in:
zhujingjing 2024-01-28 18:30:46 +08:00
parent 4739183324
commit c1ade4dc2a
Signed by: karlcw
GPG Key ID: B11805D3A0F5C671
7 changed files with 746 additions and 317 deletions

View File

@ -26,3 +26,5 @@ export declare function equalsIgnoreCase(source: string | undefined, target: str
* @returns * @returns
*/ */
export declare const includeIgnoreCase: (list: string[], search: string) => boolean; 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

View File

@ -15,7 +15,7 @@
"devDependencies": { "devDependencies": {
"prettier": "^3.0.3", "prettier": "^3.0.3",
"typescript": "^5.0.2", "typescript": "^5.0.2",
"vite": "^4.4.5", "vite": "^5.1.0-beta.5",
"vite-plugin-dts": "^3.6.3", "vite-plugin-dts": "^3.6.3",
"vue": "^3.2.47" "vue": "^3.2.47"
}, },

File diff suppressed because it is too large Load Diff

View File

@ -39,9 +39,9 @@ export function stringTokenizer<T>(
* *
* undefinedtrue * undefinedtrue
* false * false
* @param source * @param source
* @param target * @param target
* @returns * @returns
*/ */
export function equalsIgnoreCase( export function equalsIgnoreCase(
source: string | undefined, source: string | undefined,
@ -73,3 +73,15 @@ export const includeIgnoreCase = (list: string[], search: string) => {
return false; 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);
};

View File

@ -1,10 +1,10 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2020", "target": "ESNext",
"useDefineForClassFields": true, "useDefineForClassFields": true,
"module": "ESNext", "module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"], "lib": ["ES2021", "DOM", "DOM.Iterable"],
"skipLibCheck": true, "skipLibCheck": true,
/* Bundler mode */ /* Bundler mode */
"moduleResolution": "bundler", "moduleResolution": "bundler",