lepu-test-platform-web/node_modules/schema-utils/README.md

2.8 KiB

npm node deps test coverage chat

Schema Utils

Install

npm install --save schema-utils

Usage

validateOptions

import validateOptions from 'schema-utils'

validateOptions('path/to/schema.json', options, 'Loader/Plugin Name')

Examples

Loader

import { getOptions } from 'loader-utils'
import validateOptions from 'schema-utils'

function loader (src, map) {
  const options = getOptions(this) || {}

  validateOptions('path/to/schema.json', options, 'Loader Name')
}

Plugin

import Tapable from 'tapable'
import validateOptions from 'schema-utils'

class Plugin extends Tapable {
  constructor (options) {
    validateOptions('path/to/schema.json', options, 'Plugin Name')
  }
}

Maintainers


Juho Vepsäläinen

Joshua Wiens

Michael Ciniawsky