Comparing version 0.0.1 to 0.1.0
{ | ||
"name": "ajv-async", | ||
"version": "0.0.1", | ||
"description": "Managing and detecting async validation mode in Ajv - JSON-Schema validator", | ||
"version": "0.1.0", | ||
"description": "Configure async validation mode in Ajv - JSON-Schema validator", | ||
"main": "index.js", | ||
@@ -23,3 +23,7 @@ "scripts": { | ||
"async", | ||
"asynchronous", | ||
"asynchronous validation", | ||
"ajv", | ||
"generators", | ||
"async-function", | ||
"co", | ||
@@ -34,3 +38,7 @@ "nodent", | ||
}, | ||
"homepage": "https://github.com/epoberezkin/ajv-async#readme" | ||
"homepage": "https://github.com/epoberezkin/ajv-async#readme", | ||
"devDependencies": { | ||
"nodent": "^3.0.7", | ||
"regenerator": "^0.9.5" | ||
} | ||
} |
# ajv-async | ||
Managing and detecting async validation mode in Ajv - JSON-Schema validator | ||
Configure async validation mode in [Ajv](https://github.com/epoberezkin/ajv) - JSON-Schema validator | ||
[![npm version](https://badge.fury.io/js/ajv-async.svg)](https://www.npmjs.com/package/ajv-async) | ||
[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) | ||
## Install | ||
```shell | ||
npm install ajv-async | ||
``` | ||
## Usage | ||
The code below configures async mode in Ajv instance to use the best async mode (async functions or generators) available in the current environment with/without transpilation. If transpilation is required, you should install [nodent](https://github.com/MatAtBread/nodent) or [regenerator](https://github.com/facebook/regenerator), ajv-async doesn't install them. | ||
```javascript | ||
var Ajv = require('ajv'); | ||
var setupAsync = require('ajv-async'); | ||
var ajv = setupAsync(new Ajv); | ||
``` | ||
`async` and/or `transpile` options can be passed to Ajv to enable a specific async/transpilation mode. See [Ajv docs](https://github.com/epoberezkin/ajv#asynchronous-validation) for more information. | ||
## Using in browser | ||
At the moment Ajv already includes nodent and regenerators bundles. You still need to use this package, unless you manually set `async` option and explicitely pass `processCode` option. `transpile` option support requires using this package. | ||
If you build this package with your code with Webpack, it will log warnings because this package uses optional dependencies. To suppress these warnings use [IgnorePlugin](https://webpack.github.io/docs/list-of-plugins.html#ignoreplugin): | ||
```javascript | ||
new IgnorePlugin(/regenerator|nodent/, /ajv-async/) | ||
``` | ||
## License | ||
[MIT](https://github.com/epoberezkin/ajv-async/blob/master/LICENSE) |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
7502
5
115
42
2
2
2