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

cerebral-forms

Package Overview
Dependencies
Maintainers
2
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cerebral-forms - npm Package Compare versions

Comparing version 1.0.0-b-alpha.3b97c05c to 1.0.0-b-alpha.4690d3a2

9

lib/helpers/getFormFields.js

@@ -19,12 +19,7 @@ 'use strict';

});
currentPath.pop();
return allFields;
} else if (object[key] === Object(object[key]) && 'value' in object[key]) {
allFields[currentPath.join('.')] = object[key];
currentPath.pop();
return allFields;
} else if (object[key] === Object(object[key])) {
getFormFields(object[key], currentPath, allFields);
}
getFormFields(object[key], currentPath, allFields);
currentPath.pop();

@@ -31,0 +26,0 @@

{
"name": "cerebral-forms",
"version": "1.0.0-b-alpha.3b97c05c",
"version": "1.0.0-b-alpha.4690d3a2",
"description": "Signals, actions and state factories to create forms",

@@ -28,7 +28,7 @@ "main": "lib/index.js",

"peerDependencies": {
"cerebral": "^2.0.0-b-alpha.3b97c05c"
"cerebral": "^2.0.0-b-alpha.4690d3a2"
},
"devDependencies": {
"@cerebral/monorepo": "^0.0.1-alpha.3b97c05c",
"cerebral": "^2.0.0-b-alpha.3b97c05c"
"@cerebral/monorepo": "^0.0.1-alpha.4690d3a2",
"cerebral": "^2.0.0-b-alpha.4690d3a2"
},

@@ -35,0 +35,0 @@ "nyc": {

@@ -50,6 +50,4 @@ # cerebral-forms

// Some properties are created for you, set when validation runs
// and you can use them in components. You can also set these
// properties manually, though usually the validate action factory
// is used to handle this
// Some properties are created for you by the validate action factory
// which can be used in the components.

@@ -97,2 +95,22 @@ // Toggled when field is validated

#### Custom global props
You can add custom props to the root to the form state.
For example if you want to show validation errors only
when submitting the form you can add a `showErrors` prop
which you set true when validation fails during form submit.
```js
import {form} from 'cerebral-forms'
export default function MyAction({state}) {
state.set('some.new.form', form({
name: {
value: '',
},
showErrors: false
}))
}
```
#### Set a default value for the whole form

@@ -108,3 +126,3 @@ You can set a default value for a property using a factory:

// You can also set some special properties for the whole form
newForm.showErrors = false
myForm.showErrors = false

@@ -121,22 +139,2 @@ fields.forEach((field) => {

#### Custom global props
You can add custom props to the root to the form state.
For example if you want to show validation errors only
when submitting the form you can add a `showErrors` prop
which you set true when validation fails during form submit.
```js
import {form} from 'cerebral-forms'
export default function MyAction({state}) {
state.set('some.new.form', form({
name: {
value: '',
},
showErrors: false
}))
}
```
### field

@@ -143,0 +141,0 @@ To add a new field you simply merge a new form into the existing one.

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