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

tabjson

v1.0.3

Published

Turns tab-spaced new lines into an array of populated objects.

Downloads

1

Readme

TabJson

Turns tab-spaced new lines into an array of populated objects without relying on the call stack.

Install

npm install tabjson --save or yarn add tabjson --save

Example

const tabjson = require('tabjson')

const list = tabjson(`bobby
  #age: 18
  email: [email protected]
  @preferences: stew, brooms, ducks
  wallet
    #amount: 16
    currency: USD
sally
  #age: 45
  email: [email protected]
  @preferences: winning, internet fights, rainbows
  pets
    tommy
      type: cat
      #age: 3
      #weight: 16
    josephine
      type: lizard
      #age: 2
      @likes: flies, lsd, jazz
      @#favoriteNumbers: 7, 14`)

console.log(JSON.stringify(list, null, 2))

Output

[
  {
    "bobby": {
      "age": 18,
      "email": "[email protected]",
      "preferences": [
        "stew",
        "brooms",
        "ducks"
      ],
      "wallet": {
        "amount": 16,
        "currency": "USD"
      }
    }
  },
  {
    "sally": {
      "age": 45,
      "email": "[email protected]",
      "preferences": [
        "winning",
        "internet fights",
        "rainbows"
      ],
      "pets": {
        "tommy": {
          "type": "cat",
          "age": 3,
          "weight": 16
        },
        "josephine": {
          "type": "lizard",
          "age": 2,
          "likes": [
            "flies",
            "lsd",
            "jazz"
          ],
          "favoriteNumbers": [
            7,
            14
          ]
        }
      }
    }
  }
]

Notation Breakdown

bobby                                               // This is new object with a property called 'bobby' (no colon)
  #age: 18                                          // This is an age number of bobby (#)
  email: [email protected]                         // This is an email string of bobby
  @preferences: stew, brooms, ducks                 // This is a preferences arrary of bobby (@)
  wallet                                            // This is a wallet object of bobby (no colon)
    #amount: 16                                     // This is an amount number of bobby's wallet (#)
    currency: USD                                   // This is the currency string of bobby's wallet (#)
sally                                               // This is new object with a property called 'sally' (no colon)
  #age: 45                                          // This is an age number of sally (#)
  email: [email protected]                        // This is an email string of sally
  @preferences: winning, internet fights, rainbows  // This is a preferences array of sally (@)
  pets                                              // This is a pet object of sally (no colon)
    tommy                                           // This is sally's pet named tommy (no colon)
      type: cat                                     // This is a type string of tommy
      #age: 3                                       // This is tommy's age number (#)
      #weight: 16                                   // This is tommy's weight number (#)
    josephine                                       // This is sally's pet named josephine (no colon)
      type: lizard                                  // This is a type string of josephine
      #age: 2                                       // This is josephine's age number (#)
      @likes: flies, lsd, jazz                      // This is a likes arrary of josephine (@)
      @#favoriteNumbers: 7, 14                      // This is a favorite numbers number array of josephine (@#)

Roadmap

  • Add support for object arrays (@ and no colon)
  • Add path referencing ($)
  • Add inline function processing via () => {}
  • Add template literal support for new lines (`)
  • Add support for regex types (?)
  • Add tests that make sure things work in weird cases
  • Add syntax error and recommendation detection