初始化提交

This commit is contained in:
2025-10-03 16:49:53 +08:00
parent 157ca32e2d
commit bdd67a65fa
1066 changed files with 373311 additions and 261 deletions

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function makeRegistry(base) {
return {
_data: {},
add: function (name, func) {
// precautionary case conversion, as later querying of
// the registry by function-caller uses lower case as well.
name = name.toLowerCase();
// eslint-disable-next-line no-prototype-builtins
if (this._data.hasOwnProperty(name)) {
// TODO warn
}
this._data[name] = func;
},
addMultiple: function (functions) {
var _this = this;
Object.keys(functions).forEach(function (name) {
_this.add(name, functions[name]);
});
},
get: function (name) {
return this._data[name] || (base && base.get(name));
},
getLocalFunctions: function () {
return this._data;
},
inherit: function () {
return makeRegistry(this);
},
create: function (base) {
return makeRegistry(base);
}
};
}
exports.default = makeRegistry(null);
//# sourceMappingURL=function-registry.js.map