String

Make a new Template

const { Dubnium, Template } = require('dubnium') // require('dubnium') is an alias of require('dubnium').Dubnium
const template = new Template("Hello, {0}")

Use Template

database.create('tag', template.use("World"))

The parameters of this function determine the index's value in the string.

Example: the parameter 0 will be the value of World since they are both at index 0.

Full code example

string_template.js
const { Dubnium, Template } = require('dubnium')
// import { Dubnium, Template } from 'dubnium' // for ESM
const database = new Dubnium('./db', 'txt') // Initialize a database

const template = new Template("Hello, {0}") // Make a new Template

database.create('tag', template.use('World')) // Create a Record based on the Template

Last updated