beeshell/dist/common/utils/validator.js
2024-03-16 14:11:43 +08:00

25 lines
556 B
JavaScript

function dispatch(...funcs) {
return function (...args) {
return funcs.some((item) => {
const ret = item.apply(this, args);
return ret;
});
};
}
function register(key, func) {
const keyArray = key.split(',');
return function (...args) {
if (keyArray.indexOf(args[0]) !== -1) {
func.apply(this, args);
return true;
}
else {
return false;
}
};
}
export default {
dispatch,
register
};
//# sourceMappingURL=validator.js.map