How to use the joi-strict.boolean function in joi-strict

To help you get started, we’ve selected a few joi-strict 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 blackflux / js-gardener / src / index.js View on Github external
const depusedSubtask = require('./subtasks/depused');

const taskNames = [
  'robo',
  'structure',
  'audit',
  'eslint',
  'yamllint',
  'depcheck',
  'depused'
];
const schema = Joi.object().keys({
  logger: Joi.any(),
  cwd: Joi.string(),
  skip: Joi.array().items(Joi.string().valid(...taskNames)).unique(),
  docker: Joi.boolean()
});

module.exports = (options = {}) => {
  assert(options instanceof Object && !Array.isArray(options));
  const ctx = {
    logger: log,
    cwd: process.cwd(),
    skip: [],
    docker: false,
    ...options
  };
  assert(
    schema.validate(ctx).error === undefined,
    `Parameter Validation Error: ${schema.validate(ctx).error}`
  );

joi-strict

Thin wrapper around joi that defaults to stricter validation.

MIT
Latest version published 8 months ago

Package Health Score

55 / 100
Full package analysis