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 🙏

© 2024 – Pkg Stats / Ryan Hefner

toguru-panel-cli

v1.0.5

Published

Queries toggles for cultures and includes helper methods

Downloads

2

Readme

toguru-panel-cli

Filter exsting toguru toggles by property values

Setup up

  1. Run npm install toguru-panel-cli --save in your project

Configure & Use Toguru.js

  1. Include toguru-panel-cli in your project with const Toguru = require('toguru-panel-cli')
  2. Create a Toguru object with const toguru = Toguru(toguruToken)
    • Where toguruToken is your decrypted toguru token string.
  3. Call toguru.toggles() to receive an Observable of all toggles, and chain any filter predicates you want
  4. Chain .subscribe(toguru.sink) to your last observable filter operation to pretty print the resulting JSON

Examples

Run the included example with node example.js -t <your-toguru-token>.

Analagous to an SQL query, it:

"selects" toggles where

  • the toggle's team is gecloud
  • the toggle is fully rolled out
  • the toggle is defined for the classified-detail service.
toguru.toggles()                                        // SELECT * FROM TOGGLES
    .filter(toguru.teamToggles("gecloud"))              // WHERE (TOGGLES.TEAM = "gecloud"
    .filter(toguru.fullRollout)                         // AND TOGGLES.ROLLOUT_PERCENTAGE = 100
    .filter(toguru.toggleServices("classified-detail")) // AND TOGGLES.SERVICES = "classified-detail)"
    .subscribe(toguru.sink);                            // pretty prints result(s) to STDOUT

Running tests

  1. npm run test

Extend or write your own filters

To do this, write a predicate function that accepts a toggle object and returns true or false, and filter the toggles based on your predicate.

  • E.g. toguru.toggles().filter((toggle) => toggle.id === "my-toggle-id")

Contributing to the existing library

  1. Make a pull request with your changes describing what it does and why it is applicable to the general user base
  2. All library functionality should live in /lib/toguru.js, and extend the existing API
  3. Include tests for your new changes and make sure all old and new tests run with npm run test

Toggle JSON structure

Warning: some toggles are missing fields since they are user defined. Be sure to be aware of this when writing your own filters

{
	"id": "<toggle-id>",
	"tags": {
		"team": "<team-name>",
		"stack": "<stack-name>",
		"services": "<service-name(s)>"
	},
	"rolloutPercentage": <[0 - 100]>
}