# assert-valid-glob-opts

> Assert a given object is a valid glob option

Latest version **1.0.0** (published 2017-05-29) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install assert-valid-glob-opts
pnpm add assert-valid-glob-opts
yarn add assert-valid-glob-opts
bun add assert-valid-glob-opts
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-05-29 |
| First published | 2017-01-24 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Shinnosuke Watanabe |
| Maintainers | shinnn |
| Keywords | glob, option, validate, invalidate, check, type, error, throw, assert, assertion, strict |

## Links

- npm: https://www.npmjs.com/package/assert-valid-glob-opts
- Repository: https://github.com/shinnn/assert-valid-glob-opts
- Homepage: https://github.com/shinnn/assert-valid-glob-opts#readme
- Issues: https://github.com/shinnn/assert-valid-glob-opts/issues
- npm.io page: https://npm.io/package/assert-valid-glob-opts

## Dependencies (2)

- [glob-option-error](https://npm.io/package/glob-option-error.md) ^1.0.0
- [validate-glob-opts](https://npm.io/package/validate-glob-opts.md) ^1.0.0

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-05-29
- 0.4.0 — 2017-05-26
- 0.3.0 — 2017-05-17
- 0.2.0 — 2017-03-03
- 0.1.0 — 2017-01-25
- 0.0.0 — 2017-01-24

## README

# assert-valid-glob-opts

[![NPM version](https://img.shields.io/npm/v/assert-valid-glob-opts.svg)](https://www.npmjs.com/package/assert-valid-glob-opts)
[![Build Status](https://travis-ci.org/shinnn/assert-valid-glob-opts.svg?branch=master)](https://travis-ci.org/shinnn/assert-valid-glob-opts)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/assert-valid-glob-opts.svg)](https://coveralls.io/r/shinnn/assert-valid-glob-opts)

Assert a given object is a valid [node-glob](https://github.com/isaacs/node-glob) option

```javascript
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.](https://docs.npmjs.com/cli/install)

```
npm install assert-valid-glob-opts
```

## API

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

### assertValidGlobOpts(*obj* [, *customValidations*])

*obj*: `Object` ([`glob` options](https://github.com/isaacs/node-glob#options))  
*customValidations*: `Array<Function>` (passed to [`validate-glob-opts`](https://github.com/shinnn/validate-glob-opts#validategloboptsobj--customvalidations))

It validates a given object with [validate-glob-opts](https://github.com/shinnn/validate-glob-opts) and throws an error if the value is not valid.

```javascript
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](https://creativecommons.org/publicdomain/zero/1.0/deed)

---
_Source: https://npm.io/package/assert-valid-glob-opts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
