grid filter
This commit is contained in:
@ -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
|
||||
}
|
Reference in New Issue
Block a user