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

formact

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formact - npm Package Compare versions

Comparing version 2.0.5 to 2.0.6

7

lib/index.js

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

var value = getValue(name);
var fieldValue = getValue(name);

@@ -347,4 +347,4 @@ var update = function update(newvalue) {

return {
value: value,
var payload = {
fieldValue: fieldValue,
update: update,

@@ -358,2 +358,3 @@ showError: showError,

};
return payload;
};

@@ -360,0 +361,0 @@

{
"name": "formact",
"version": "2.0.5",
"version": "2.0.6",
"description": "Context for React form components with validation",

@@ -5,0 +5,0 @@ "scripts": {

@@ -367,2 +367,13 @@ // @flow

export type FieldPayload = {
fieldValue?: string,
update: (value: string) => any,
showError: boolean,
errorMessage?: string,
onBlur: (e?: Object) => any,
submit: () => any,
submitting: boolean,
valid: boolean,
}
export const useField = (props: FieldProps) => {

@@ -436,6 +447,16 @@ const { name } = props

const value = getValue(name)
const fieldValue = getValue(name)
const update = (newvalue: string) => updateValue(name, newvalue)
return { value, update, showError, error, onBlur, submit, submitting, valid }
const payload: FieldPayload = {
fieldValue,
update,
showError,
error,
onBlur,
submit,
submitting,
valid,
}
return payload
}

@@ -448,3 +469,6 @@

return (props: Object) => {
const fieldProps = useField({ ...props, defaultErrorMessages })
const fieldProps: FieldPayload = useField({
...props,
defaultErrorMessages,
})

@@ -451,0 +475,0 @@ return <Component {...props} {...fieldProps} />

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