naml

2.0.0 • Public • Published


  • Simple, unified API.
  • Freely convert between:

    • JSON (JavaScript Object Notation): .json
    • HJSON (Human JSON): .hjson
    • JSON5 (ES5 JSON): .json5
    • CSON (CoffeeScript Object Notation): .cson
    • YAML (Yet Another Markup Language): .yaml
    • TOML (Tom's Obvious, Minimal Language): .toml
    • INI (Initialization File Format): .ini

Installation

npm install naml

CLI

naml [input-file] [output-file]

Example: naml path/to/input.yaml path/to/output.json

API

const NAML = require('naml')

NAML.parse(string, type)

  • string {String}: the String to be parsed
  • type {String}: the input type; one of the following: json, hjson, json5, cson, yaml, toml, ini (may be prefixed with a .)
  • returns {Object}: the resulting Object
  • throws {Error}: if parsing failed

NAML.stringify(object, type)

  • object {Object}: the Object to be stringified
  • type {String}: the input type; one of the following: json, hjson, json5, cson, yaml, toml, ini (may be prefixed with a .)
  • returns {String}: the resulting String
  • throws {Error}: if stringifying failed

License

WTFPL – Do What the F*ck You Want to Public License.

Made with ❤️ by @MarkTiedemann.

Dependencies (10)

Dev Dependencies (2)

Package Sidebar

Install

npm i naml

Weekly Downloads

35

Version

2.0.0

License

WTFPL

Last publish

Collaborators

  • marktiedemann