stoc
v1.1.0
Published
String to object compiler for javascript
Downloads
388
Readme
Stoc
String to object compiler for Javascript
Installation
npm install stoc
# or
yarn install stoc
Usage
const stoc = require('stoc');
stoc(`
{
name
gender
children {
name: nickname
age
hobbies: habits {
name
type
}
}
}
`)
// or
stoc('{name gender children{name:nickname age hobbies:habits{name type}}}')
// Output =>
{
name: 1,
gender: 1,
children: {
name: 'nickname',
age: 1,
hobbies: 'habits',
habits: {
name: 1,
type: 1
}
}
}
Enjoy !