npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

toml-node

v0.0.1

Published

TOML ====

Downloads

3

Readme

TOML

Tom's Own Markup Language.

By Tom Preston-Werner.

TOML is like INI, only better. And standardized.

If it's not working for you, you're not drinking enough whisky.

Example

# This is a TOML document. Boom.

title = "TOML Example"

[owner]
name = "Tom Preston-Werner"
organization = "GitHub"
bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
dob = 1979-05-27T07:32:00Z # First class dates? Why not?

[database]
server = "192.168.1.1"
ports = [ "8001", "8001", "8002" ]
connection_max = 5000

[servers]

  # You can indent as you please. Tabs or spaces. TOML don't care.
  [servers.alpha]
  ip = "10.0.0.1"
  dc = "eqdc10"

  [servers.beta]
  ip = "10.0.0.2"
  dc = "eqdc10"

Spec

TOML is designed to be unambiguous and as simple as possible. There should only be one way to do anything. TOML maps to a simple hash.

Comments

Speak your mind with the hash symbol. They go from the symbol to the end of the line.

# I am a comment. Hear me roar. Roar.
key = "value" # Yeah, you can do this.

Primitives

String, Integer, Float, Datetime, Array.

Strings are UTF8 surrounded by double quotes. Quotes and other special characters must be escaped.

"I'm a string. \"You can quote me\". Tab \t newline \n you get it."

Integers are bare numbers, all alone.

42

Floats are like integers except they have a single dot within.

3.1415

Datetimes are ISO8601 dates, but only the full zulu form is allowed.

1979-05-27T07:32:00Z

Arrays are square brackets with other primitives inside. Elements are separated by commas. No, you can't mix data types, that's stupid.

[ 1, 2, 3 ]
[ "red", "yellow", "green" ]
[ [ 1, 2 ], [3, 4, 5] ]

That's it. That's all you need, and you're gonna like it.

Hash me

There are two ways to make keys. I call them "key groups" and "keys". Both are just regular keys, but key groups only ever have a single has as their value.

Key groups appear in square brackets on a line by themselves. You can tell them apart from arrays because arrays are only ever values.

[keygroup]

Under that, and until the next key or EOF are the key/values of that key group. keys are on the left of the equals sign and values are on the right. Keys start with the first non-whitespace character and end with the last non-whitespace character before the equals sign.

[keygroup]
key = "value"

You can indent keys and their values as much as you like. Tabs or spaces. Knock yourself out. Why, you ask? Because you can have nested hashes. Snap.

Nested hashes are denoted by key groups with dots in them. Name your key groups whatever crap you please, just don't use a dot. Dot is reserved. OBEY.

[key.tater]
type = "pug"

In JSON land, that would give you the following structure.

{ 'key': { 'tater': { 'type': 'pug' } } }

You don't need to specify all the superkeys if you don't want to. TOML knows how to do it for you.

# [x] you
# [x.y] don't
# [x.y.z] need these
[x.y.z.w] # for this to work

Be careful not to overwrite previous keys. That's dumb. And should produce an error.

# DO NOT WANT
[fruit]
type = "apple"

[fruit.type]
apple = "yes"

Seriously?

Yep.

But why?

Because we need a decent human readable format that maps to a hash and the YAML spec is like 600 pages long and gives me rage. No, JSON doesn't count. You know why.

Oh god, you're right

Yuuuup. Wanna help? Send a pull request. Or write a parser. BE BRAVE.

License

MIT.