Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cdxoo/formik-ajv-async

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

@cdxoo/formik-ajv-async - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

10

dist/cjs/convert-ajv-errors.js

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

var convertAjvErrors = function convertAjvErrors(ajvErrors //data
) {
var convertAjvErrors = function convertAjvErrors(ajvErrors) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var errorInstancePathPrefix = options.errorInstancePathPrefix;
if (!(0, _utils.isArray)(ajvErrors)) {

@@ -57,2 +59,6 @@ if ((0, _utils.isAnyObject)(ajvErrors) && ajvErrors['0']) {

if (errorInstancePathPrefix && instancePath.startsWith(errorInstancePathPrefix)) {
instancePath = instancePath.replace(errorInstancePathPrefix, '');
}
if (!_jsonpointer["default"].get(errors, instancePath)) {

@@ -59,0 +65,0 @@ //var value = jsonpointer.get(data, instancePath);

7

dist/cjs/with-ajv-errors.js

@@ -41,3 +41,4 @@ "use strict";

dataPrefix = _options.dataPrefix,
errorResponsePath = _options.errorResponsePath;
errorResponsePath = _options.errorResponsePath,
errorInstancePathPrefix = _options.errorInstancePathPrefix;
var setErrors = formikBag.setErrors;

@@ -56,3 +57,5 @@

var ajvErrors = getAjvErrorsFromResponse(error.response, errorResponsePath);
var converted = (0, _convertAjvErrors.convertAjvErrors)(ajvErrors, values);
var converted = (0, _convertAjvErrors.convertAjvErrors)(ajvErrors, {
errorInstancePathPrefix: errorInstancePathPrefix
});
setErrors(applyDataPrefix(converted, dataPrefix));

@@ -59,0 +62,0 @@ });

@@ -9,4 +9,6 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }

import { isAnyObject, isArray } from './utils';
export var convertAjvErrors = function convertAjvErrors(ajvErrors //data
) {
export var convertAjvErrors = function convertAjvErrors(ajvErrors) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var errorInstancePathPrefix = options.errorInstancePathPrefix;
if (!isArray(ajvErrors)) {

@@ -46,2 +48,6 @@ if (isAnyObject(ajvErrors) && ajvErrors['0']) {

if (errorInstancePathPrefix && instancePath.startsWith(errorInstancePathPrefix)) {
instancePath = instancePath.replace(errorInstancePathPrefix, '');
}
if (!jsonpointer.get(errors, instancePath)) {

@@ -48,0 +54,0 @@ //var value = jsonpointer.get(data, instancePath);

@@ -28,3 +28,4 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

dataPrefix = _options.dataPrefix,
errorResponsePath = _options.errorResponsePath;
errorResponsePath = _options.errorResponsePath,
errorInstancePathPrefix = _options.errorInstancePathPrefix;
var setErrors = formikBag.setErrors;

@@ -43,3 +44,5 @@

var ajvErrors = getAjvErrorsFromResponse(error.response, errorResponsePath);
var converted = convertAjvErrors(ajvErrors, values);
var converted = convertAjvErrors(ajvErrors, {
errorInstancePathPrefix: errorInstancePathPrefix
});
setErrors(applyDataPrefix(converted, dataPrefix));

@@ -46,0 +49,0 @@ });

{
"name": "@cdxoo/formik-ajv-async",
"version": "0.2.0",
"version": "0.3.0",
"description": "",

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

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