Support parsing string contains object-liked syntax that can not be parsed by JSON.parse()
Sometimes, you receive string that has value like "{ sort: { date: 'DES' } }" and you want to parse it into an object. First solution would be, of course, JSON.parse().
However, your string is not valid JSON-formatted string so JSON.parse() will fail to parse it. That is the reason why I made this parse-object module.
npm install --save parse-objectconst parse = require('parse-object');
const str = "{ sort: { date: 'DES' } }";
console.log(parse(str)); // { sort: { date: 'DES' } }
console.log(JSON.parse(str)); // raise errorparse-object can also parse any output from JSON.stringify()
const parse = require('parse-object');
const stringified = JSON.stringify({ name: "me", id: 123456 });
console.log(parse(stringified)); // { name: "me", id: 123456 }