How to use joi-strict - 5 common examples

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 yamllintSubtask = require('./subtasks/yamllint');
const depcheckSubtask = require('./subtasks/depcheck');
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}`
github blackflux / js-gardener / src / index.js View on Github external
const depcheckSubtask = require('./subtasks/depcheck');
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}`
  );
github blackflux / js-gardener / src / index.js View on Github external
const eslintSubtask = require('./subtasks/eslint');
const yamllintSubtask = require('./subtasks/yamllint');
const depcheckSubtask = require('./subtasks/depcheck');
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,
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}`
  );
github blackflux / js-gardener / src / index.js View on Github external
const auditSubtask = require('./subtasks/audit');
const eslintSubtask = require('./subtasks/eslint');
const yamllintSubtask = require('./subtasks/yamllint');
const depcheckSubtask = require('./subtasks/depcheck');
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(

joi-strict

Thin wrapper around joi that defaults to stricter validation.

MIT
Latest version published 10 months ago

Package Health Score

53 / 100
Full package analysis