str-to-obj

1.0.2 • Public • Published

str-to-obj

Get an object from a string which is separated by some endpoints

Example

Code

const stringToObject = require('str-to-obj');

const queryString = 'type:car,color:blue,year:2005';
const myObject = stringToObject(queryString, ',', ':');

console.log(myObject);

Result

{
    type: 'car',
    color: 'blue',
    year: '2005'
}

Package Sidebar

Install

npm i str-to-obj

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

1.52 kB

Total Files

4

Last publish

Collaborators

  • zetogk