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

easy-react-form

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-react-form - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

18

commonjs/form.js

@@ -6,3 +6,3 @@ 'use strict';

});
exports.default = exports.Context = undefined;
exports.default = exports.Context = exports.setDefaultOnError = undefined;

@@ -43,2 +43,9 @@ var _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; };

var defaultOnError = function defaultOnError(error) {
return false;
};
var setDefaultOnError = exports.setDefaultOnError = function setDefaultOnError(onError) {
return defaultOnError = onError;
};
var Context = exports.Context = (0, _createReactContext2.default)();

@@ -428,3 +435,3 @@

} catch (error) {
if (onError(error) === false) {
if ((onError || defaultOnError)(error) === false) {
throw error;

@@ -457,3 +464,3 @@ }

promise.then(this.onAfterSubmit, function (error) {
if (onError(error) === false) {
if ((onError || defaultOnError)(error) === false) {
throwError = error;

@@ -514,3 +521,3 @@ }

requiredMessage: _propTypes2.default.string.isRequired,
onError: _propTypes2.default.func.isRequired,
onError: _propTypes2.default.func,
plugins: _propTypes2.default.arrayOf(_propTypes2.default.func).isRequired

@@ -521,5 +528,2 @@ }, _class.defaultProps = {

requiredMessage: 'Required',
onError: function onError(error) {
return false;
},
plugins: [_onAbandon2.default] }, _temp);

@@ -526,0 +530,0 @@ exports.default = Form;

@@ -5,2 +5,3 @@ 'use strict'

exports.Field = require('./commonjs/field').default
exports.Submit = require('./commonjs/submit').default
exports.Submit = require('./commonjs/submit').default
exports.setDefaultOnError = require('./commonjs/form').setDefaultOnError

@@ -1,3 +0,3 @@

export { default as Form } from './modules/form'
export { default as Form, setDefaultOnError } from './modules/form'
export { default as Field } from './modules/field'
export { default as Submit } from './modules/submit'

@@ -6,3 +6,3 @@ 'use strict';

});
exports.default = exports.Context = undefined;
exports.default = exports.Context = exports.setDefaultOnError = undefined;

@@ -43,2 +43,9 @@ var _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; };

var defaultOnError = function defaultOnError(error) {
return false;
};
var setDefaultOnError = exports.setDefaultOnError = function setDefaultOnError(onError) {
return defaultOnError = onError;
};
var Context = exports.Context = (0, _createReactContext2.default)();

@@ -428,3 +435,3 @@

} catch (error) {
if (onError(error) === false) {
if ((onError || defaultOnError)(error) === false) {
throw error;

@@ -457,3 +464,3 @@ }

promise.then(this.onAfterSubmit, function (error) {
if (onError(error) === false) {
if ((onError || defaultOnError)(error) === false) {
throwError = error;

@@ -514,3 +521,3 @@ }

requiredMessage: _propTypes2.default.string.isRequired,
onError: _propTypes2.default.func.isRequired,
onError: _propTypes2.default.func,
plugins: _propTypes2.default.arrayOf(_propTypes2.default.func).isRequired

@@ -521,5 +528,2 @@ }, _class.defaultProps = {

requiredMessage: 'Required',
onError: function onError(error) {
return false;
},
plugins: [_onAbandon2.default] }, _temp);

@@ -526,0 +530,0 @@ exports.default = Form;

{
"name": "easy-react-form",
"version": "1.0.4",
"version": "1.0.5",
"description": "Simple, fast and easy-to-use React Form.",

@@ -66,5 +66,3 @@ "main": "index.commonjs.js",

"react",
"redux",
"form",
"simple"
"form"
],

@@ -71,0 +69,0 @@ "author": "catamphetamine <purecatamphetamine@gmail.com>",

@@ -235,2 +235,15 @@ # easy-react-form

## onError
To set default `<Form/>`'s `onError` handler:
```js
import { setDefaultOnError } from 'easy-react-form'
setDefaultOnError((error) => {
console.error(error)
alert(error.message)
})
```
## Field errors

@@ -237,0 +250,0 @@

Sorry, the diff of this file is not supported yet

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