Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type: add nonZhScope #267

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions types/core/pinyin/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export interface BasicOptions {
* @value removed:返回结果移除非汉字字符
*/
nonZh?: "spaced" | "consecutive" | "removed";
/**
* @description nonZh 生效范围的正则表达式
*/
nonZhScope?: RegExp;
/**
* @description 对于 ü 的返回是否转换成 v(仅在 toneType: none 启用时生效)
* @value false:返回值中保留 ü (默认值)
Expand Down
1 change: 1 addition & 0 deletions types/core/pinyin/middlewares.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { SingleWordResult } from "../../common/type";
import { CompleteOptions } from "./index";
export declare const validateType: (word: unknown) => boolean;
export declare function isNonZhScope(char: string, scope?: RegExp): boolean;
export declare const middleWareNonZh: (list: SingleWordResult[], options: CompleteOptions) => SingleWordResult[];
export declare const middlewareMultiple: (word: string, options: CompleteOptions) => SingleWordResult[] | false;
export declare const middlewarePattern: (list: SingleWordResult[], options: CompleteOptions) => void;
Expand Down
Loading