@forge/resolver
1.7.11.8.0-next.0
out/index.js~
out/index.jsModified+8
Index: package/out/index.js
===================================================================
--- package/out/index.js
+++ package/out/index.js
@@ -12,8 +12,10 @@
}
if (functionKey in this.functions) {
throw new Error(`Resolver definition '${functionKey}' already exists.`);
}
+ // Individual resolver functions are not type-checked inside the array. The
+ // types are only checked when adding them via makeResolver.
this.functions[functionKey] = cb;
return this;
}
getFunction(functionKey) {
@@ -46,8 +48,14 @@
};
}
}
exports.default = Resolver;
+/**
+ * Creates resolver definitions corresponding to a given Definitions type.
+ *
+ * @param handlers Resolver functions implementing the definitions
+ * @returns Resolver definitions
+ */
function makeResolver(handlers) {
const resolver = new Resolver();
for (const key of Object.keys(handlers)) {
resolver.define(key, handlers[key]);