feat: change to center and clean code
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* 提取 {{}} 中的 key
|
||||
* @param text
|
||||
* @returns
|
||||
*/
|
||||
export function extractKeysFromBraces(text: string) {
|
||||
const regex = /\{\{\s*(.*?)\s*\}\}/g;
|
||||
const keys: string[] = [];
|
||||
let matches: RegExpExecArray | null;
|
||||
|
||||
while ((matches = regex.exec(text)) !== null) {
|
||||
keys.push(matches[1]); // 获取{{}}中间的key
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
Reference in New Issue
Block a user