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

hochuli

v1.0.0-beta.2

Published

Opinionated JavaScript library for handling feature flags.

Readme

Hochuli

Build Status

Hochuli - "The strongest toggle library in the world."

Hochuli is a module for managing features in your applications. It helps facilitate Trunk Based Development by defining the concepts of release and business toggles. It's a good idea to familiarize yourself with these concepts here. Named after the famed Ed Hochuli.

Installation

npm install hochuli

Usage

Features are defined in two categories, release or business.

import Hochuli from 'hochuli'

// Create a Toggles instance
const Toggles = new Hochuli({
  applicationID: 'my-test-app'
})

// Some user id's that we'll use later
const QAUserUUIDs = [
  '5c6dd8cf-c55b-427d-99d2-9d859273c00c',
  'ca050d9c-dce8-4b34-8612-19f510701685',
  '9b447de2-7d4c-463d-857a-44b19dcd8c13'
]


// Define rules that can be assigned to features
Toggles.rules(function() {
  // A Group rule representing the QA team
  this.rule('qa-team', 'user_uuid').group(QAUserUUIDs)
})

// Define in-app features managed by developers
Toggles.release(function() {
  // This feature is given the 'on' Bool-type rule
  this.feature('friend-referrals', 'allow user to refer friends').on();
  // This feature evaluates to `true` given
  this.feature('one-step-link-a-bank', 'allow users to link a bank in one step', 'user_uuid').on('qa-team');
});

// Define external features managed by the buisness
Toggles.business(function() {
  // By default this feature is given the 'off' Bool-type rule
  this.feature('show-confetti', 'display a nice confetti animation').off();
});

new Hochuli(options)

An instance of the Hochuli class is needed to start managing your togls.

options

  • applicationID - A unique identifier representing your application
  • defaultFeatureTargetType - The default Target Type associated with a feature if not provided
  • togglesDigestURL - URL to an external Togle manifest (see example)
  • rulesDigestURL - URl to an external Rules manifest (see example)
  • cachePrefix - Prefix for cache keys
  • caching - Cache toggle and rule digests (defaults to false)

Hochuli.rules(block)

rules() provides a DSL for defining rules that can later be assigned to features. This function takes another function which exposes a rule() on it's this context. Notice that we can the call bool or group on this.rule to define what type of rule it is.

  • rule(id, targetType)

Example:

hochuli.rules(function() {
  this.rule('admin-group', 'user_uuid').group(adminUUIDs)
})

Hochuli.release(block)

release() is used to define features as release togls. It exposes a this.feature function on the function that you pass it. Note that a targetType is optional but you really should specify one.

  • this.feature(id, description, targetType)

Example:

hochuli.release(function() {
  this.feature('my-sweet-feat', 'Do something awesome').on()
})

Hochuli.business(block)

business() is used to define features as business togls. It again exposes a this.feature function that works exactly like above.

Hochuli.feature(id)

feature() returns a Togl instance that exposes a single isOn method. isOn takes optional context data that gets fed into the feature's rule's run method. This is the interface used for controlling features in your code.

  • isOn(context)

Example:

hochuli.feature('my-sweet-feat').isOn() // => false
hochuli.feature('super-secret-feature').isOn(anAdminUUID) // => true

Hochuli.sync()

sync() is used to refresh the in-memory store's business toggle and rules definitions. It returns a Promise. Sync will also result in rule and toggle manifests being persisted in localStorage (if available) along with their ETags. Subsequent sync calls will make special GET requests that include the cached manifest ETags.

Hochuli.getState()

getState() returns the entire serialized representation of your app's features and rules. Note that it doesn't return Toggles as these are simply runtime representations of a feature and corresponding rule.

Development

Developing

    1. git clone [email protected]:timkendall/hochuli.git && cd hochuli
    1. yarn install
    1. npm run test:watch

Building

npm run build

Publishing

npm publish

License

MIT © Tim Kendall