toml-parser

A TOML parser for node.js

TOML.js

    apbmba:toml aaronblohowiak$ node
    > toml = require('./toml.js')
    [Function: parse]
    > str = require('fs').readFileSync('./toml/example.toml', 'utf-8')
    '# This is a TOML document. Boom.\n\ntitle = "TOML Example"\n\n[owner]\nname = "Tom Preston-Werner"\norganization = "GitHub"\nbio = "GitHub Cofounder & CEO\\nLikes tater tots and beer."\ndob = 1979-05-27T07:32:00Z # First class dates? Why not?\n\n[database]\nserver = "192.168.1.1"\nports = [ "8001", "8001", "8002" ]\nconnection_max = 5000\n\n[servers]\n\n  # You can indent as you please. Tabs or spaces. TOML don\'t care.\n  [servers.alpha]\n  ip = "10.0.0.1"\n  dc = "eqdc10"\n\n  [servers.beta]\n  ip = "10.0.0.2"\n  dc = "eqdc10"\n\n\n\n'
    > toml(str)
    { title: 'TOML Example',
      name: { name: 'Tom Preston-Werner' },
      organization: { organization: 'GitHub' },
      bio: { bio: 'GitHub Cofounder & CEO\nLikes tater tots and beer.' },
      dob: { dob: Sun May 27 1979 00:32:00 GMT-0700 (PDT) },
      server: { server: '192.168.1.1' },
      ports: { ports: [ '8001', '8001', '8002' ] },
      connection_max: { connection_max: 5000 },
      alpha: 
       { ip: { ip: '10.0.0.1' },
         dc: { dc: 'eqdc10' } },
      beta: 
       { ip: { ip: '10.0.0.2' },
         dc: { dc: 'eqdc10' } } }
    > 

Known limitations: does not error on heterogeneous arrays.