Socket
Socket
Sign inDemoInstall

har-validator

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

har-validator - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

src/schemas.json

2

package.json
{
"version": "1.0.2",
"version": "1.1.0",
"name": "har-validator",

@@ -4,0 +4,0 @@ "description": "Extremely fast HTTP Archive (HAR) validator using JSON Schema",

@@ -25,11 +25,27 @@ # HAR Validator [![version][npm-version]][npm-url] [![License][npm-license]][license-url]

###### CLI
### CLI
```
Usage: har-validator <file ...>
Options:
-h, --help output usage information
-V, --version output the version number
-s, --schema [request | response] validate sub schema
```
###### Example
```shell
har-validator ./path/to/file.har
har-validator ./path/to/har.json
har-validator --schema ./path/to/request.json
```
###### Code
### Code
```js
var HAR = require('har.json');
var validate = require('har-validator');

@@ -46,2 +62,15 @@

```js
var request = require('request.json');
var validate = require('har-validator');
validate(request, function (err, valid) {
if (err) console.log(err)
if (valid) {
console.log('horray!');
}
});
```
## License

@@ -48,0 +77,0 @@

'use strict';
var validator = require('is-my-json-valid/require');
var validate = validator('./schema.json');
var validator = require('is-my-json-valid');
var schemas = require('./schemas.json');
module.exports = function (data, cb) {
var runner = function (schema, data, cb) {
var validate = validator(schema, {
schemas: schemas
});
var valid = false;

@@ -21,1 +25,11 @@

};
module.exports = function (data, cb) {
return runner(schemas.log, data, cb);
};
Object.keys(schemas).map(function (name) {
module.exports[name] = function (data, cb) {
return runner(schemas[name], data, cb);
};
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc