@jswork/next-data-transform
v1.0.23
Published
Data transform for next.
Downloads
313
Readme
next-data-transform
Data transform for next.
installation
npm install -S @jswork/next-data-transform
apis
| api | params | description | | ---------- | ------ | --------------------------------- | | raw | data | Do nothing | | json | data | application/json;charset=utf-8 | | urlencoded | data | application/x-www-form-urlencoded | | multipart | data | multipart/form-data |
usage
import NxDataTransform from '@jswork/next-data-transform';
const data = { key: 1, value: 2 };
NxDataTransform.raw(data); // { key: 1, value: 2 };
NxDataTransform.json(data); // '{"key":1,"value":2}'
NxDataTransform.urlencoded(data); // key=1&value=2
NxDataTransform.multipart(data); // `[object FormData]`
license
Code released under the MIT license.