JSPM

assert-valid-glob-opts

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 30253
  • Score
    100M100P100Q161729F
  • License CC0-1.0

Assert a given object is a valid glob option

Package Exports

  • assert-valid-glob-opts

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (assert-valid-glob-opts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

assert-valid-glob-opts

NPM version Build Status Coverage Status

Assert a given object is a valid node-glob option

assertValidGlobOpts({
  sync: true,
  ignore: /node_modules/
});
TypeError: 2 errors found in the glob options:
  1. `sync` option is deprecated and there’s no need to pass any values to that option, but true was provided.
  2. node-glob expected `ignore` option to be an array or string, but got /node_modules/.
    at assertValidGlobOpts (/Users/shinnn/example/index.js:29:9)
    at Object.<anonymous> (/Users/shinnn/example/app.js:2:1)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:420:7)
    at startup (bootstrap_node.js:139:9)

Installation

Use npm.

npm install assert-valid-glob-opts

API

const assertValidGlobOpts = require('assert-valid-glob-opts');

assertValidGlobOpts(obj [, customValidations])

obj: Object (glob options)
customValidations: Array<Function> (passed to validate-glob-opts)

It validates a given object with validate-glob-opts and throws an error if the value is not valid.

const assertValidGlobOpts = require('assert-valid-glob-opts');

const ok = {
  mark: true,
  matchBase: false
};

assertValidGlobOpts(ok); // doesn't throw

const notOk = {
  mark: 'true',
  matchbase: false
};

assertValidGlobOpts(notOk); // throws an error

License

Creative Commons Zero v1.0 Universal