Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

toml

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

toml

TOML parser for Node.js (parses TOML spec v0.4.0)

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is toml?

The 'toml' npm package is a library for parsing and stringifying TOML (Tom's Obvious, Minimal Language) data. TOML is a configuration file format that is easy to read due to its simplicity and human-readable syntax. This package allows you to convert TOML data to JavaScript objects and vice versa.

What are toml's main functionalities?

Parsing TOML to JavaScript Object

This feature allows you to parse a TOML string into a JavaScript object. The example demonstrates parsing a TOML string containing an 'owner' table with 'name' and 'dob' fields.

const toml = require('toml');
const tomlString = `
[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00Z
`;
const parsedData = toml.parse(tomlString);
console.log(parsedData);

Stringifying JavaScript Object to TOML

This feature allows you to convert a JavaScript object into a TOML string. The example demonstrates stringifying a JavaScript object with an 'owner' property into a TOML formatted string.

const toml = require('toml');
const jsObject = {
  owner: {
    name: "Tom Preston-Werner",
    dob: new Date('1979-05-27T07:32:00Z')
  }
};
const tomlString = toml.stringify(jsObject);
console.log(tomlString);

Other packages similar to toml

Keywords

FAQs

Package last updated on 30 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc