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 🙏

© 2025 – Pkg Stats / Ryan Hefner

json-sl

v2.0.2

Published

Valid JSON, but also dynamic features such as random, references, and.. stuff.

Downloads

8

Readme

json-sl

json-sl is a project that adds dynamic things to JSON. json-sl files are valid JSON, not the other way around.

Using json-sl in a <script> tag:

<script src="https://s-p-n.github.io/json-sl/json-sl.js"></script>
<textarea id="out"></textarea>
<script>
    let myJson = jsonSL({
      "list": "range(5,15)",
      "roll": "rand(0,20)",
      "result": ".You Lose!",
      "result if roll in list": ".You win!"
    });
</script>

Requiring json-sl as an NPM Module:

You can install it like this:

npm i json-sl

The json-sl module is a function that takes in JSON and spits out, well, different JSON. You can use it like this:

    require('json-sl')({
        "list": "range(5,15)",
        "roll": "rand(0,20)",
        "result": ".You Lose!",
        "result if roll in list": ".You win!"
    });

Playground

If I were looking at something (json-sl) I had no idea what it was, but might (somehow) be related to something I was doing, I would want a playground. In fact, I would open this playground in a new tab, and try some of the features from this readme..

Features

  • Perform math using these operators: !%^*/+-()
  • Generate random data using the rand(min,max) function.
  • Generate ranges of numbers using range(to), range(start, end), or range(start, stop, step)
  • Reference properties using their names. my.attack - opp.defense
  • Use parent to walk up. parent.age
  • Use prop if val is 1 as a property name to set prop only if val is 1.
  • Use prop if in range(0,5) as a property name to overwrite prop if the current value is between 0-5.

Install from Git

You should have Node.js, NPM, and the 'git' command. These are instructions for linux, and you may have to change some things for Windows.

open a Terminal and use cd to get to the place where you want the json-sl folder to be downloaded.

git clone https://github.com/s-p-n/json-sl
cd json-sl
npm i

Running in the Terminal

To run this, get your terminal into the json-sl directory. Once you are there, pass a JSON file to run it like below:

node run data/attack.json

There are some JSON files that work in the data directory. Those work well as examples. Try copying one, making changes, and creating something new and interesting.

Documentation

For more information regarding json-sl, please visit the wiki.

Enjoy!