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

hson-wasm

v1.0.10

Published

Hson for javascript

Readme

HSON-WASM

Use hson from javascript.

Usage

See example.js or example.html for full examples.
The lib directory contains a ready to use wasm file.
Run cargo build --target wasm32-unknown-unknown --release to rebuild the wasm file, copy the new wasm file from 'target/wasm32-unknown-unknown/release/hson_wasm.wasm' to 'lib' folder and rename it to hson.wasm.

Instantiation

const Hson = require('hson-wasm');

await Hson.instantiate();

// Client-side
await Hson.instantiate(path_to_wasm);

const hson = Hson.new();

Parsing

const data = `{
    "div": {
      "attrs": {
        "class": ["active", 123, 0.25864, "test"],
        "onClick": "doSomething"
      },
      "div": {
        "p": {
          "attrs": {
            "id": 12,
            "rate": 0.4321,
            "trusted": true,
            "text": "foo"
          },
          "span": {
            "text": "Hello"
          }
        },
        "p": {
          "span": {
            "text": "World"
          }
        }
      },
      "div": {
        "component": "test",
        "attrs": {},
        "onClick": "componentDoSomething"
      }
    }
  }`;

hson.parse(data);
/* ... */

Stringify

const s = hson.stringify();
console.log(s);

Searching

See https://crates.io/crates/hson#Searching for all options.
Searching will return an array of nodes identifier (int), see Querying to get nodes vertexes.

const search = hson.search("div");
console.log(search); // [ 2, 10, 22 ]

// Search in a specific node
const search = hson.search_in(search[0], "div");
console.log(search); // [ 10, 22 ]

Querying

Work as Searching but return nodes vertexes instead of identifiers.

const query = hson.query("div");
console.log(query);

/* Will print:

[   
    { 
      childs: [ 3, 10, 22 ],
      id: 2,
      key: 'div',
      kind: 'Node',
      parent: 1,
      value: '"attrs":{"class":["active",123,0.25864,"test"],"onClick":"doSomething"},"div":{"p":{"attrs":{"id":12,"rate":0.4321,"trusted":true,"text":"foo"},"span":{"text":"Hello"}},"p":{"span":{"text":"World"}}},"div":{"component":"test","attrs":{},"onClick":"componentDoSomething"}' 
    },
    { 
      childs: [ 11, 19 ],
      id: 10,
      key: 'div',
      kind: 'Node',
      parent: 2,
      value: '"p":{"attrs":{"id":12,"rate":0.4321,"trusted":true,"text":"foo"},"span":{"text":"Hello"}},"p":{"span":{"text":"World"}}' 
    },
    { 
      childs: [ 23, 24, 25 ],
      id: 22,
      key: 'div',
      kind: 'Node',
      parent: 2,
      value: '"component":"test","attrs":{},"onClick":"componentDoSomething"' 
    } 
]
*/

// Or query a specific node
const query = hson.query_on(query[0], "div");
console.log(query);

Insert

Insert data in the node at provided position.

const new_data = `{
    "ul": {
      "li": {
        "text": "World"
      }
    }
  }`;

// node_id, position, data
hson.insert(search[0], 0, new_data);
  /* ... */

Remove

hson.remove(search[2]);
  /* ... */

Replace

hson.replace(search[1], new_data);
  /* ... */

Utils

Is_child

console.log(hson.is_child(search[0], search[1]));

Cast

const query = hson.query("id");
console.log(query[0].cast());