@albertoarana/decoder-parameters
v1.0.1
Published
A decoder parameters function to transform data in params format
Downloads
7
Readme
Decoder Parameters
Installation
If you are using yarn
yarn add @albertoarana/decoder-parameters
or npm
npm install @albertoarana/decoder-parameters --save
Use
Without serialize
import decoderParameters from '@albertoarana/decoder-parameters';
const params = '?name=Alberto&lastName=Arana';
decoderParameters(params);
// ouput: {name: 'Alberto', lastName: 'Arana'}
With serialize
import decoderParameters from '@albertoarana/decoder-parameters';
const serialize = {
filterName: 'name',
filterLastName: 'lastName'
};
const params = '?filterName=Alberto&FilterLastName=Arana';
decoderParameters(params, serialize);
// ouput: {name: 'Alberto', lastname: 'Arana'}