factorial-form
v3.3.1
Published
Factorial form library
Downloads
782
Keywords
Readme
Factorial form
Minimal library for dealing with form state.
Installation
npm install factorial-form --save
yarn add factorial-form
Example
import { Form } from 'factorial-form'
const attributes = {
name: 'paco',
salary: 18000,
created_at: 1497521766937,
metadata: {
friends: 12
}
}
const schema = {
name: 'string',
salary: 'cents',
age: 'timestamp',
metadata: {
friends: 'number'
}
}
const form = new Form(attributes, schema)
const field = form.get('name')
field.value // => 'paco'
form.isDirty // => false
field.set('pepe')
field.value // => 'pepe'
field.isDirty // => true
form.isDirty // => true
Where is it used?
Developed and battle tested in production in Factorial