fromform

0.1.1 • Public • Published

fromform

Create form from object, change object from form.

Usage

const fromform = require('fromform');
const data = {
    name: {
        _type: 'text',
        _value: 'Bob'
    },
    gender: {
        _type: 'select',
        _options: [
            'male', 'female'
        ]
    },
    weight: {
        number: {
            _type: 'number'
        },
        unit: {
            _type: 'select',
            _options: [
                'kilogram', 'pound'
            ]
        }
    },
    favouriteColor: {
        _type: 'color',
        _value: '#000'
    }
};
let f = fromform(obj); // return a DocumentFragment instance
document.getElementById('form-container').appendChild(f);

License

MIT

Copyright (c) 2017-present, shenfe

Readme

Keywords

none

Package Sidebar

Install

npm i fromform

Weekly Downloads

0

Version

0.1.1

License

MIT

Last publish

Collaborators

  • hengwu