MCPcopy Create free account
hub / github.com/cryptii/cryptii / register

Method register

src/Factory.js:43–53  ·  view source on GitHub ↗

* Registers invokable to specified identifier. * @param {string} identifier * @param {class} invokable * @throws Throws an error if identifier already exists. * @return {Factory} Fluent interface

(identifier, invokable)

Source from the content-addressed store, hash-verified

41 * @return {Factory} Fluent interface
42 */
43 register (identifier, invokable) {
44 if (this.exists(identifier)) {
45 throw new Error(
46 'Invokable can\'t be registered. ' +
47 `Identifier ${identifier} already exists.`)
48 }
49 // register invokable
50 this._identifiers.push(identifier)
51 this._invokables.push(invokable)
52 return this
53 }
54
55 /**
56 * Returns true, if given identifier exists.

Callers 2

Factory.jsFile · 0.45
runMethod · 0.45

Calls 1

existsMethod · 0.95

Tested by

no test coverage detected