JSON
Make a new Template
const { Dubnium, Template } = require('dubnium') // require('dubnium') is an alias of require('dubnium').Dubnium
const template = new Template({
id:"required",
name:"",
password:"required"
})
Parameter
About
Type
Required
template
The object to base the new Template on.
Object
Use Template
database.create('tag', template.use('123456',"John","password"))
The parameters of this function are what will be set to the value of the keys in order.
Example: the parameterJohn
will be the value of name
since they are both in the second position.
Full code example
const { Dubnium, Template } = require('dubnium')
// import { Dubnium, Template } from 'dubnium' // for ESM
const database = new Dubnium('./db','json') // Initialize a database
const template = new Template({ // Make a new Template
id:"",
name:"",
password:""
})
database.create('tag', template.use('123456',"John","password")) // Create a Record based on the Template
Last updated
Was this helpful?