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

@shopify/react-form-state

Package Overview
Dependencies
Maintainers
19
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/react-form-state - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1-address-mocks-minified-beta.0

2

build/ts/components/List.js

@@ -14,3 +14,3 @@ import React from 'react';

const { field: { onChange }, } = this.props;
onChange(value => {
onChange((value) => {
const existingItem = value[index];

@@ -17,0 +17,0 @@ const newItem = Object.assign(Object.assign({}, existingItem), { [key]: typeof newValue === 'function'

@@ -13,3 +13,3 @@ import React from 'react';

const { field: { onChange }, } = this.props;
onChange(value => {
onChange((value) => {
return Object.assign(Object.assign({}, value), { [key]: typeof newValue === 'function'

@@ -16,0 +16,0 @@ ? newValue(value[key])

@@ -40,3 +40,3 @@ import React from 'react';

fields: FieldStates<Fields>;
dirtyFields: Array<keyof Fields>;
dirtyFields: (keyof Fields)[];
errors: RemoteError[];

@@ -43,0 +43,0 @@ externalErrors: RemoteError[];

@@ -13,3 +13,3 @@ /* eslint-disable no-case-declarations */

this.reset = () => {
return new Promise(resolve => {
return new Promise((resolve) => {
this.setState((_state, props) => createFormState(props.initialValues, props.externalErrors), () => resolve());

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

validateForm() {
return new Promise(resolve => {
return new Promise((resolve) => {
this.setState(runAllValidators, () => resolve());

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

const { fields } = this.state;
return Object.keys(fields).some(fieldPath => {
return Object.keys(fields).some((fieldPath) => {
const field = fields[fieldPath];

@@ -204,3 +204,3 @@ return field.error != null;

}
this.setState(state => ({
this.setState((state) => ({
fields: Object.assign(Object.assign({}, state.fields), { [fieldPath]: Object.assign(Object.assign({}, state.fields[fieldPath]), { error }) }),

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

function createFormState(values, externalErrors = []) {
const fields = mapObject(values, value => {
const fields = mapObject(values, (value) => {
return {

@@ -285,4 +285,4 @@ value,

const errors = validate
.map(validator => validator(value, fields))
.filter(input => input != null);
.map((validator) => validator(value, fields))
.filter((input) => input != null);
if (errors.length === 0) {

@@ -312,5 +312,5 @@ return;

if (Array.isArray(message)) {
return flatMap(message, itemError => collectErrors(itemError));
return flatMap(message, (itemError) => collectErrors(itemError));
}
return flatMap(Object.values(message), nestedError => collectErrors(nestedError));
return flatMap(Object.values(message), (nestedError) => collectErrors(nestedError));
}

@@ -17,4 +17,4 @@ import { lengthLessThan, lengthMoreThan, notEmpty, notEmptyString, isEmpty, notNumericString, isNumericString, isPositiveNumericString, } from '@shopify/predicates';

const errors = validate
.map(validator => validator(value, fields))
.filter(input => input != null);
.map((validator) => validator(value, fields))
.filter((input) => input != null);
if (errors.length === 0) {

@@ -26,4 +26,4 @@ return;

const anyErrors = Object.keys(errors)
.map(key => errors[key])
.some(value => value != null);
.map((key) => errors[key])
.some((value) => value != null);
if (anyErrors) {

@@ -37,4 +37,4 @@ return errors;

return (input, fields) => {
const errors = input.map(item => validateItem(item, fields));
if (errors.some(error => error != null)) {
const errors = input.map((item) => validateItem(item, fields));
if (errors.some((error) => error != null)) {
return errors;

@@ -41,0 +41,0 @@ }

{
"name": "@shopify/react-form-state",
"version": "1.0.0",
"version": "1.0.1-address-mocks-minified-beta.0",
"license": "MIT",

@@ -34,3 +34,3 @@ "description": "Manage React forms tersely and type-safely with no magic",

"@shopify/enzyme-utilities": "^3.0.0",
"@shopify/useful-types": "^3.0.0",
"@shopify/useful-types": "^3.0.1-address-mocks-minified-beta.0",
"faker": "^4.1.0"

@@ -57,3 +57,3 @@ },

},
"gitHead": "40de4af181104f298cbab42d2d3d68e228a9a31a"
"gitHead": "1a19759d10db9ca65d346141b10e7b0654e023e6"
}

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