feat:filter match 扩充 * 用法 (#2216)

Co-authored-by: qinhaoyan <qinhaoyan@baidu.com>
This commit is contained in:
qinhaoyan 2021-07-05 10:56:47 +08:00 committed by GitHub
parent f228d018b2
commit d3a4b71a8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -448,9 +448,12 @@ export const filters: {
fn = value => reg.test(String(value));
}
// 判断keys是否为*
const isAsterisk = /\s*\*\s*/.test(keys);
keys = keys.split(/\s*,\s*/);
return input.filter((item: any) =>
keys.some((key: string) => fn(resolveVariable(key, item), key, item))
// 当keys为*时从item中获取key
(isAsterisk ? Object.keys(item) : keys).some((key: string) => fn(resolveVariable(key, item), key, item))
);
},
base64Encode(str) {