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

flaggyjs

v1.0.2

Published

> Made with ❤️‍🔥 by [David Jiménez](https://dubis.dev)

Downloads

7

Readme

FlaggyJS 🚩 - Manage bitewise flags wisely

Made with ❤️‍🔥 by David Jiménez

FlaggyJS is a lightweight TypeScript library for managing bitwise flags. Powerful and efficient binary flags managing for permission systems, feature toggles, or any use-case.

// 1. Import the library
import { useFlags } from "flaggyjs";

// 2. Define your flags
const { flags, FlagsContainer } = useFlags(["AMAZING", "SIMPLE", "BORING"] as const);

// 3. Create as many containers as you need
const flaggy = new FlagsContainer();
const documentation = new FlagsContainer([flags.SIMPLE, flags.BORING]); // Initialize with flags 🚀

// 4. Start working with fully Typed flags
flaggy.addFlag(flags.AMAZING); // Add one flag 🚩
flaggy.addFlags(flags.SIMPLE, flags.BORING); // or many flags at once 🚄
flaggy.removeFlag(flags.BORING); // Flaggy is not boring! 🎉

// 🔒 FlaggyJS is type safe
                   // v Argument of type "Too Long" is not assignable... // Fails type checking
documentation.addFlag("Too Long") // ⚠️ Error! => Invalid flag provided  // Also on runtime

// 5. Evaluate your flags when needed
console.log(flaggy.hasFlag(flags.AMAZING)); // true
console.log(documentation.hasFlag(flags.SIMPLE)); // true
console.log(flaggy.hasFlag(flags.BORING)); // false

console.log(flags)
// {
//     AMAZING: "AMAZING",
//     SIMPLE: "SIMPLE",
//     BORING: "BORING"
// }

Features

  • 🔒 Type-safe flag management without Enums.
  • 🤏 Zero dependencies - No extra packages are used.
  • 🧙‍♂️ Bitwise operations: Efficiently manage flags with bitwise operations under the hood.
  • 🔎 Validation: Ensures invalid flags are caught early.
  • 💎 Immutable flag definitions: Prevent accidental changes to the flag definitions.

Installation

npm install flaggyjs

API

  • hasFlag(flag: FlagId): boolean Checks if a flag is currently set.

  • addFlag(flag: FlagId): void Adds a flag to the current set.

  • removeFlag(flag: FlagId): void Removes a flag from the current set.

  • addFlags(...flags: FlagId[]): void Adds multiple flags at once.

Testing

The package uses Vitest for testing. To run the tests:

bun run test

Development

Building

The package uses tsc for building TypeScript into JavaScript:

bun run build