Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

str-to-obj

zetogk5ISC1.0.2

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

string to object, str to obj, string, object

readme

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'
}