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 🙏

© 2026 – Pkg Stats / Ryan Hefner

toon-config

v1.0.2

Published

A modern configuration engine using Token-Oriented Object Notation (TOON) - a type-safe alternative to YAML and JSON

Readme

🎯 TOON Config

A modern configuration engine using Token-Oriented Object Notation (TOON) — a clean, type-safe alternative to YAML and JSON.

Why TOON?

  • Type-safe tokens with built-in validation
  • Better error messages than YAML/JSON
  • Human-readable syntax
  • Zero dependencies
  • Comments support using ##
  • Bidirectional — parse TOON or generate it from JS objects

Installation

npm install toon-config

Bonus: VS Code syntax highlighting is automatically installed! Just reload VS Code after installation.

Quick Start

1. Create a .toon config file

## config.toon
OBJ(
   STR(appName, "Polystudi"),
   BOOL(debug, true),
   INT(port, 3001),
   LIST(modules, "auth", "api", "db"),
   OBJ(database,
      STR(host, "localhost"),
      INT(port, 27017),
      STR(user, "admin")
   )
)

2. Load it in your app

import { loadConfig } from 'toon-config';

const config = await loadConfig('./config.toon');

console.log(config.appName);  // "Polystudi"
console.log(config.port);     // 3001
console.log(config.database.host);  // "localhost"

API Reference

loadConfig(filePath)

Asynchronously load and parse a .toon file.

const config = await loadConfig('./config.toon');

loadConfigSync(filePath)

Synchronously load and parse a .toon file.

import { loadConfigSync } from 'toon-config';
const config = loadConfigSync('./config.toon');

parseString(toonString)

Parse a TOON string directly.

import { parseString } from 'toon-config';

const config = parseString(`
OBJ(
   STR(name, "MyApp"),
   INT(port, 3000)
)
`);

stringifyTOON(object, indent)

Convert a JavaScript object to TOON format.

import { stringifyTOON } from 'toon-config';

const toonString = stringifyTOON({
  appName: "Web3 Notes",
  debug: false,
  port: 8080
});

console.log(toonString);

Output:

OBJ(
   STR(appName, "Web3 Notes"),
   BOOL(debug, false),
   INT(port, 8080)
)

TOON Syntax

Supported Tokens

| Token | Type | Example | |-------|------|---------| | STR | String | STR(name, "value") | | INT | Integer | INT(count, 42) | | FLOAT | Float | FLOAT(price, 19.99) | | BOOL | Boolean | BOOL(enabled, true) | | LIST | Array | LIST("a", "b", "c") | | OBJ | Object | OBJ(STR(key, "val")) |

Comments

Use ## for single-line comments:

## This is a comment
OBJ(
   STR(name, "test")  ## inline comment
)

Nested Objects

OBJ(
   STR(appName, "MyApp"),
   OBJ(database,
      STR(host, "localhost"),
      INT(port, 5432),
      OBJ(credentials,
         STR(user, "admin"),
         STR(password, "secret")
      )
   )
)

Lists

LIST("auth", "api", "db")
LIST(1, 2, 3, 4, 5)
LIST(true, false, true)

Type Safety

TOON validates types at parse time:

// ❌ This will throw an error
parseString('INT(value, true)');
// Error: Type mismatch: expected Integer token, got boolean
// ✅ This works
parseString('INT(value, 42)');

Error Messages

TOON provides clear, actionable error messages:

Type mismatch: expected Integer token, got boolean at line 3, column 15
Unterminated string at line 5, column 8

Testing

Run the test suite:

npm test

Use Cases

  • Application configuration files
  • Environment-specific settings
  • API endpoint definitions
  • Feature flags
  • Database connection configs
  • Build tool configurations

Comparison

| Feature | TOON | JSON | YAML | |---------|------|------|------| | Type-safe | ✅ | ❌ | ❌ | | Comments | ✅ | ❌ | ✅ | | Human-readable | ✅ | ⚠️ | ✅ | | Clear errors | ✅ | ❌ | ❌ | | Bidirectional | ✅ | ✅ | ⚠️ |

VS Code Extension

TOON Config comes with a VS Code extension for syntax highlighting!

Auto-install: The extension is automatically installed when you run npm install toon-config

Manual install: Search for "TOON Config Language" in VS Code Extensions, or:

code --install-extension atharva-baodhankar.toon-vscode

Features:

  • 🎨 Syntax highlighting for .toon files
  • 💬 Comment support with ##
  • 🔧 Auto-closing brackets and quotes
  • 📝 Smart indentation

Repository

GitHub: atharvabaodhankar/toon-config

License

MIT

Contributing

Contributions welcome! Please open an issue or PR on GitHub.

Author

Created by @op_athu_17


Made with ❤️ for better config management