scaffoldql
v0.1.1
Published
A library that is used to generate object blueprints. Inspired by graphql
Downloads
4
Maintainers
Readme
ScaffoldQL
ScaffoldQL is a JavaScript library that is used to generate objects using scaffolds.
Inspired by GraphQL
Installation:
npm install --save scaffoldql
Usage:
Simple Usage:
const { init } = require('scaffoldql')
const queryString = `
{
parent {
child {
grandchild
}
anotherChild
}
anotherParent
}`
const store = init()
console.log(store.scaffold(queryString))
/*
{
parent: {
child: {
grandchild: null
},
anotherChild: null
},
anotherParent: null
}
*/
With Types:
const { init } = require('scaffoldql')
const queryString = `
{
name: String
friends: Array
sex: String
}
`
const store = init()
console.log(store.scaffold(queryString))
/*
{
name: '',
friends: [],
sex: ''
}
*/
By Defining Schemas
const { init } = require('scaffoldql')
const queryString = `
define Person {
name: String
friends: Array
sex: String
}
`
const store = init()
store.registerSchema(queryString)
console.log(store.scaffoldSchema('Person'))
/*
{
name: '',
friends: [],
sex: ''
}
*/