grid filter

This commit is contained in:
tsanie committed 2023-04-24 17:38:48 +08:00
1 parent 4096068a62
commit 811467bc7a
3 files changed
+146 -33

No files matched your search

-13
View File
@@ -39,18 +39,6 @@ function truncate(v) {
return (v > 0 ? Math.floor : Math.ceil)(v);
}
function distinct(array, key, filter) {
const dict = Object.create(null);
for (let item of array) {
const v = typeof filter === 'function' ? filter(item) : item[key];
const val = v?.value ?? v;
if (!Object.prototype.hasOwnProperty.call(dict, val)) {
dict[val] = v;
}
}
return Object.values(dict);
}
function isEmail(text) {
return /^\w[-\w.+]*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(text);
}
@@ -87,7 +75,6 @@ export {
throttle,
debounce,
truncate,
distinct,
isEmail,
isPhone
}