1.0.2 • Published 6 years ago
@handout/prefixer v1.0.2
Prefixer
Handout plugin to automatically prefix field keys
Install
npm install --save @handout/prefixer
Usage
Prefix all fields
import Handout from '@handout/handout';
import Prefixer form '@handout/prefixer';
const form = document.querySelector('form');
const h = new Handout(form, Prefixer('user_'));
h.submit().then(res => {
// Will submit all fields as user_{key}
});
Prefix only certain fields
import Handout from '@handout/handout';
import Prefixer form '@handout/prefixer';
// Will prefix all fields except "privacy"
const filter = key => key !== 'privacy';
const form = document.querySelector('form');
const h = new Handout(form, Prefixer('user_', filter));
h.submit().then(res => {
// Will submit all fields as user_{key} except privacy
});