MCPcopy Index your code
hub / github.com/codex-team/editor.js / validateTools

Method validateTools

src/components/modules/tools.ts:379–398  ·  view source on GitHub ↗

* Validate Tools configuration objects and throw Error for user if it is invalid

()

Source from the content-addressed store, hash-verified

377 * Validate Tools configuration objects and throw Error for user if it is invalid
378 */
379 private validateTools(): void {
380 /**
381 * Check Tools for a class containing
382 */
383 for (const toolName in this.config.tools) {
384 if (Object.prototype.hasOwnProperty.call(this.config.tools, toolName)) {
385 if (toolName in this.internalTools) {
386 return;
387 }
388
389 const tool = this.config.tools[toolName];
390
391 if (!_.isFunction(tool) && !_.isFunction((tool as ToolSettings).class)) {
392 throw Error(
393 `Tool «${toolName}» must be a constructor function or an object with function in the «class» property`
394 );
395 }
396 }
397 }
398 }
399
400 /**
401 * Unify tools config

Callers 1

prepareMethod · 0.95

Calls 1

callMethod · 0.65

Tested by

no test coverage detected