Socket
Socket
Sign inDemoInstall

better-ajv-errors

Package Overview
Dependencies
25
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.4 to 0.5.5

10

lib/legacy/helpers.js
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;

@@ -11,4 +9,8 @@ exports.makeTree = makeTree;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
require("core-js/modules/es6.object.assign");
require("core-js/modules/es7.object.entries");
require("core-js/modules/es6.regexp.match");
var _utils = require("./utils");

@@ -104,3 +106,3 @@

var error = errors[0];
return [new _validationErrors.EnumValidationError((0, _extends2.default)({}, error, {
return [new _validationErrors.EnumValidationError(Object.assign({}, error, {
params: {

@@ -107,0 +109,0 @@ allowedValues

2

lib/legacy/json/get-meta-from-path.js

@@ -6,2 +6,4 @@ "use strict";

require("core-js/modules/es6.regexp.split");
function getMetaFromPath(jsonAst, dataPath, isIdentifierLocation) {

@@ -8,0 +10,0 @@ // TODO: Handle json pointer escape notation and better error handling

@@ -10,2 +10,4 @@ "use strict";

require("regenerator-runtime/runtime");
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));

@@ -12,0 +14,0 @@

@@ -6,2 +6,4 @@ "use strict";

require("core-js/modules/es7.object.values");
var eq = function eq(x) {

@@ -8,0 +10,0 @@ return function (y) {

@@ -8,3 +8,3 @@ "use strict";

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
require("core-js/modules/es6.object.assign");

@@ -49,3 +49,3 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));

dataPath = _this$options2.dataPath;
return (0, _extends2.default)({}, this.getLocation(`${dataPath}/${params.additionalProperty}`), {
return Object.assign({}, this.getLocation(`${dataPath}/${params.additionalProperty}`), {
error: `Property ${params.additionalProperty} is not expected to be here`

@@ -52,0 +52,0 @@ });

@@ -8,3 +8,3 @@ "use strict";

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
require("core-js/modules/es6.object.assign");

@@ -41,3 +41,3 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));

dataPath = _this$options2.dataPath;
return (0, _extends2.default)({}, this.getLocation(), {
return Object.assign({}, this.getLocation(), {
error: `${dataPath}: ${keyword} ${message}`

@@ -44,0 +44,0 @@ });

@@ -8,4 +8,8 @@ "use strict";

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
require("core-js/modules/es6.regexp.to-string");
require("core-js/modules/es6.array.sort");
require("core-js/modules/es6.object.assign");
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));

@@ -47,3 +51,3 @@

var bestMatch = this.findBestMatch();
var output = (0, _extends2.default)({}, this.getLocation(), {
var output = Object.assign({}, this.getLocation(), {
error: `${dataPath} ${message}: ${params.allowedValues.join(', ')}`

@@ -50,0 +54,0 @@ });

@@ -8,3 +8,3 @@ "use strict";

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
require("core-js/modules/es6.object.assign");

@@ -50,5 +50,8 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));

_proto.getError = function getError() {
var params = this.options.params;
return (0, _extends2.default)({}, this.getLocation(), {
error: `Required property ${params.missingProperty} is missing`
var _this$options2 = this.options,
message = _this$options2.message,
dataPath = _this$options2.dataPath,
params = _this$options2.params;
return Object.assign({}, this.getLocation(), {
error: `${dataPath} ${message}`
});

@@ -55,0 +58,0 @@ };

@@ -13,4 +13,2 @@ "use strict";

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
const JSON_POINTERS_REGEX = /\/[\w_-]+(\/\d+)?/g; // Make a tree of errors from ajv errors array

@@ -94,3 +92,3 @@

const error = errors[0];
return [new _validationErrors.EnumValidationError(_extends({}, error, {
return [new _validationErrors.EnumValidationError(Object.assign({}, error, {
params: {

@@ -97,0 +95,0 @@ allowedValues

@@ -12,4 +12,2 @@ "use strict";

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
class AdditionalPropValidationError extends _base.default {

@@ -36,3 +34,3 @@ constructor(...args) {

} = this.options;
return _extends({}, this.getLocation(`${dataPath}/${params.additionalProperty}`), {
return Object.assign({}, this.getLocation(`${dataPath}/${params.additionalProperty}`), {
error: `Property ${params.additionalProperty} is not expected to be here`

@@ -39,0 +37,0 @@ });

@@ -12,4 +12,2 @@ "use strict";

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
class DefaultValidationError extends _base.default {

@@ -31,3 +29,3 @@ print() {

} = this.options;
return _extends({}, this.getLocation(), {
return Object.assign({}, this.getLocation(), {
error: `${dataPath}: ${keyword} ${message}`

@@ -34,0 +32,0 @@ });

@@ -6,2 +6,4 @@ "use strict";

require("core-js/modules/es6.array.sort");
var _chalk = _interopRequireDefault(require("chalk"));

@@ -17,4 +19,2 @@

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
class EnumValidationError extends _base.default {

@@ -40,4 +40,3 @@ print() {

const bestMatch = this.findBestMatch();
const output = _extends({}, this.getLocation(), {
const output = Object.assign({}, this.getLocation(), {
error: `${dataPath} ${message}: ${params.allowedValues.join(', ')}`

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

@@ -12,4 +12,2 @@ "use strict";

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
class RequiredValidationError extends _base.default {

@@ -36,6 +34,8 @@ getLocation(dataPath = this.options.dataPath) {

const {
message,
dataPath,
params
} = this.options;
return _extends({}, this.getLocation(), {
error: `Required property ${params.missingProperty} is missing`
return Object.assign({}, this.getLocation(), {
error: `${dataPath} ${message}`
});

@@ -42,0 +42,0 @@ }

{
"name": "better-ajv-errors",
"version": "0.5.4",
"version": "0.5.5",
"description": "JSON Schema validation for Human",

@@ -26,4 +26,4 @@ "repository": "torifat/better-ajv-errors",

"dependencies": {
"@babel/code-frame": "^7.0.0-rc.1",
"@babel/runtime": "^7.0.0-rc.1",
"@babel/code-frame": "^7.0.0",
"@babel/runtime": "^7.0.0",
"chalk": "^2.4.1",

@@ -35,8 +35,9 @@ "json-to-ast": "^2.0.3",

"devDependencies": {
"@babel/cli": "^7.0.0-rc.1",
"@babel/core": "^7.0.0-rc.1",
"@babel/plugin-syntax-object-rest-spread": "^7.0.0-rc.1",
"@babel/plugin-transform-runtime": "^7.0.0-rc.1",
"@babel/preset-env": "^7.0.0-rc.1",
"babel-core": "^7.0.0-0",
"@babel/cli": "^7.0.0",
"@babel/core": "7.0.0",
"@babel/plugin-syntax-object-rest-spread": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.4.2",

@@ -47,3 +48,3 @@ "babel-plugin-add-module-exports": "^0.2.1",

"eslint-config-prettier": "^3.0.1",
"eslint-plugin-jest": "^21.21.0",
"eslint-plugin-jest": "^21.22.0",
"flow-bin": "^0.79.1",

@@ -50,0 +51,0 @@ "husky": "^0.14.3",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡ī¸ by Socket Inc