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

@apatheticwes/validation

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apatheticwes/validation - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

demo.js

13

dist/validation.js

@@ -32,5 +32,4 @@ import { ref, reactive, computed, isRef, isReactive, } from 'vue-demi';

return validations
.filter((v) => unwrap(v).$errors.length)
.reduce((errors, v) => {
return errors.concat(...unwrap(v).$errors);
return errors.concat(...unwrap(v.$errors));
}, []);

@@ -96,12 +95,12 @@ });

function setErrors(errors) {
return;
errors.forEach((error) => {
const [, field] = error.source?.pointer?.split('/') || 'form';
const value = form[field]?.$model;
const rules = schema[field] || {};
const rules = schema[field] || (schema[field] = {});
rules['server'] = {
$message: error.detail,
$validator: () => false,
$validator: () => form[field].$dirty
};
form[field].$dirty = true;
const validations = buildGroup(schema, values);
Object.defineProperties(form, Object.getOwnPropertyDescriptors(validations));
form[field].$dirty = false;
});

@@ -108,0 +107,0 @@ return form;

{
"name": "@apatheticwes/validation",
"version": "1.0.2",
"version": "1.0.3",
"description": "A lightweight schema-based validation librarie, with a holistic approach to asynchronicity",

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

@@ -7,3 +7,3 @@ import nodeResolve from '@rollup/plugin-node-resolve';

input: {
'demo.bundle': 'dist/index.js',
'demo.bundle': 'demo.js',
'fixture.bundle': 'dist/test/fixtures.js',

@@ -10,0 +10,0 @@ },

@@ -75,5 +75,5 @@ /**

return validations
.filter((v) => unwrap(v).$errors.length)
// .filter((v) => unwrap(v.$errors).length)
.reduce((errors, v) => {
return errors.concat(...unwrap(v).$errors);
return errors.concat(...unwrap(v.$errors));
}, []);

@@ -159,3 +159,3 @@ });

* @param {object} vals A data object containing the values to be validated.
* @returns {object} The object of form values, useful for composition.
* @returns {object} The same object of data values, useful for further composition.
*/

@@ -181,17 +181,18 @@ function setValues(vals) {

function setErrors(errors) {
return;
errors.forEach((error) => {
const [,field] = error.source?.pointer?.split('/') || 'form'; // if we don't find a particular field, set a generic "form" error
const value = form[field]?.$model;
const rules = schema[field] || {};
const rules = schema[field] || (schema[field] = {});
rules['server'] = {
$message: error.detail,
$validator: () => false, // form[field].$dirty // ...just go away once user interacts with field ?
$validator: () => form[field].$dirty // just go away once user interacts with field (since we we're not able to validate it client-side)
};
form[field].$dirty = true; // otherwise no validation happens
// const validations = buildGroup({[field]: rules}, values);
const validations = buildGroup(schema, values);
Object.defineProperties(form, Object.getOwnPropertyDescriptors(validations));
form[field].$dirty = false; // ?
});
// Object.defineProperties(form, Object.getOwnPropertyDescriptors(xxx));
return form;

@@ -198,0 +199,0 @@ }

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