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

@jahuty/web

v0.2.1

Published

Browser-based SDK for Jahuty's API

Downloads

23

Readme

CircleCI codecov Code Style

jahuty-web

This browser-based SDK provides convenient access to the Jahuty API from any HTML page.

Requirements

This library supports the last two major versions of major browsers. See the .browserlistrc for details.

Installation

Add the following deferred <script> tag to your document:

<script defer src="https://unpkg.com/@jahuty/[email protected]/dist/jahuty.js"></script>

Add a script to execute jahuty() after the resources and DOM have finished loading:

<script>
  document.addEventListener('DOMContentLoaded', function () {
    jahuty({ apiKey: 'YOUR_API_KEY' });
  });
</script>

Usage

Add a container for each snippet in your document using the HTML5 data-* attribute data-snippet-id:

<div data-snippet-id="YOUR_SNIPPET_ID"></div>

This will cause the innerHTML of any element with the data-snippet-id attribute to be replaced with its corresponding content:

<div data-snippet-id="YOUR_SNIPPET_ID">
  YOUR_SNIPPET_CONTENT
</div>

Rendering content

By default, Jahuty will render a snippet's published content, the content that existed the last time a teammate clicked the "Publish" button, to avoid exposing your creative process to customers.

You can render a snippet's latest content, the content that currently exists in the editor, in the current environment with the preferLatest configuration option:

<script>
  document.addEventListener('DOMContentLoaded', function () {
    jahuty({ apiKey: 'YOUR_API_KEY', preferLatest: true });
  });
</script>

You can also prefer the latest content (or not) for a single render with the data-snippet-latest attribute:

<div data-snippet-id="YOUR_SNIPPET_ID" data-snippet-latest="true"></div>

Using parameters

You can pass parameters into your snippet by passing a valid JSON string as the data-snippet-params attribute:

<div data-snippet-id="YOUR_SNIPPET_ID" data-snippet-params='{"foo":"bar"}'></div>

The parameters above would be equivalent to assigning the variables below in your snippet:

{% assign foo = "bar" %}

Tracking renders

You can record where snippets are rendered - the value of the window.location.href variable - using the data-snippet-location attribute:

<div data-snippet-id="YOUR_SNIPPET_ID" data-snippet-location="true"></div>

Caching for performance

At this time, this library does not support caching.

Handling errors

If Jahuty's API returns an error, an error will be output to the browser's console.

License

This library is licensed under the MIT license.