Socket
Socket
Sign inDemoInstall

ajv

Package Overview
Dependencies
2
Maintainers
1
Versions
354
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.4 to 0.3.5

4

lib/ajv.js

@@ -53,3 +53,5 @@ 'use strict';

return v(data);
var valid = v(data);
self.errors = v.errors;
return valid;
}

@@ -56,0 +58,0 @@

{
"name": "ajv",
"version": "0.3.4",
"version": "0.3.5",
"description": "Another JSON schema Validator",

@@ -5,0 +5,0 @@ "main": "lib/ajv.js",

@@ -54,2 +54,3 @@ # ajv - Another JSON Schema Validator

var valid = ajv.validate('mySchema', data);
if (!valid) console.log(ajv.errors);
// ...

@@ -67,8 +68,12 @@ ```

All the instance methods below are bound to the instance, so they can be used without the instance.
##### .compile(Object schema) -> Function<Object data>
Generate validating function and cache compiled schema for future use.
Generate validating function and cache the compiled schema for future use.
Validating function returns boolean and has properties `errors` with the errors from the last validation and `schema` with the reference to the original schema.
##### .validate(Object schema|String key|String ref, data) -> Boolean

@@ -78,7 +83,9 @@

Instead of the schema you can use the key that was previously passed to `addSchema` or a previously resolved reference.
Instead of the schema you can use the key that was previously passed to `addSchema`, the schema id if it was present in the schema or any previously resolved reference.
Validation errors will be available in the `errors` property of ajv instance.
##### .addSchema(Array schemas|Object schema [, String key]) -> Function<Object data>
##### .addSchema(Array<Object>|Object schema [, String key]) -> Function|Array<Function>
Add and compile schema(s). It does the same as `.compile` with two differences:

@@ -98,3 +105,3 @@

Retrieve schema previously added with `addSchema`. Validating function has `schema` property with the reference to the original schema.
Retrieve compiled schema previously added with `addSchema`. Validating function has `schema` property with the reference to the original schema.

@@ -101,0 +108,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc