New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ajv-error-messages

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ajv-error-messages - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

10

index.js
function normaliseErrorMessages(errors) {
var fields = errors.reduce(function (acc, e) {
if (e.instancePath.length && e.instancePath[0] === ".") {
acc[e.instancePath.slice(1)] = [
e.message.toUpperCase()[0] + e.message.slice(1),
];
if (e.instancePath.length && e.instancePath[0] === "/") {
let path = e.instancePath.slice(1);
if (Number.isInteger(parseInt(path, 10))) {
path = `/${path}`;
}
acc[path] = [e.message.toUpperCase()[0] + e.message.slice(1)];
} else {

@@ -8,0 +10,0 @@ acc[e.instancePath] = [e.message.toUpperCase()[0] + e.message.slice(1)];

2

package.json
{
"name": "ajv-error-messages",
"version": "2.0.0",
"version": "2.1.0",
"description": "Normalise AJV error messages",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,2 +7,6 @@ # ajv-error-messages

# AJV Version
v2 of `ajv-error-messages` has been upgraded to work with v8 of `ajv`
## Usage

@@ -52,5 +56,5 @@

fields: {
'/foo': ['Must be string']
'foo': ['Must be string']
}
}
```

@@ -37,6 +37,6 @@ var test = require("tape");

fields: {
"/foo": ["Must be string"],
"/arrayThing": ["Must NOT have more than 2 items"],
"/arrayThing/0": ["Must be string"],
"/arrayThing/1": ["Must be integer"],
foo: ["Must be string"],
arrayThing: ["Must NOT have more than 2 items"],
"arrayThing/0": ["Must be string"],
"arrayThing/1": ["Must be integer"],
},

@@ -43,0 +43,0 @@ };

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