New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

qtoml

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qtoml

Use TOML to construct object literals directly in JavaScript

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

qtoml

Use TOML to construct object literals directly in JavaScript

Coverage Status

const toml = require('qtoml')

let obj = toml`
  [example]
  key1 = ${5 + 8}
  key2 = 17

  [elpmaxe]
  1yek = 31`

console.log(obj) // {example: {key1: 13, key2: 17}, elpmaxe: {1yek: 31}}

DESCRIPTION

This module provides a tagged template string for contructing objects using TOML.

toml`string` -> Object

The provided string must be valid TOML or an error will be thrown. Embedded expressions are evaluted and included and can evaluate to any datatype that can be used in TOML. For example, the following is valid:

obj = toml`a = ${new Date()}` // equivalent of {a: new Date()}

Only values that can be represented as TOML are allowed. Trying to include other values will throw. For example, a single-type array is fine:

let value = [1, 2, 3]
obj = toml`a = ${value}` // {a: [1, 2, 3]}

But a mixed-type array is not:

let value = ['a', 'b', 1, 2]
obj = toml`a = ${value}` // throws

Keywords

toml

FAQs

Package last updated on 20 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts