How to use the optimal.instance function in optimal

To help you get started, we’ve selected a few optimal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github milesj / boost / packages / core / src / ConfigLoader.ts View on Github external
Object.values(this.tool.getRegisteredPlugins()).forEach(type => {
      const { contract, singularName, pluralName } = type!;

      this.debug('Generating %s blueprint', chalk.magenta(singularName));

      // prettier-ignore
      pluginsBlueprint[pluralName] = array(union>([
        string().notEmpty(),
        shape({ [singularName]: string().notEmpty() }),
        instance(contract as Constructor, true),
      ], []));
    });
github milesj / boost / packages / core / src / ConfigLoader.ts View on Github external
Object.values(this.tool.getRegisteredPlugins()).forEach(type => {
      const { contract, singularName, pluralName } = type!;

      this.debug('Generating %s blueprint', color.pluginName(singularName));

      // prettier-ignore
      pluginsBlueprint[pluralName] = array(union>([
        string().notEmpty(),
        shape({ [singularName]: string().notEmpty() }),
        instance(contract, true),
      ], []));
    });

optimal

Build, validate, and transform values with immutable typed schemas.

MIT
Latest version published 3 years ago

Package Health Score

47 / 100
Full package analysis