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

wwl-js-filter-registry

v0.1.0

Published

The filter registry is a collection wrapper to white- and blacklist it's entries. By calling ```get``` and passing a key, the registry will filter it's entries based on the regular expressions listed in the whitelist and blacklist. Additionally, you can p

Downloads

2

Readme

wwl-node-filter-registry

The filter registry is a collection wrapper to white- and blacklist it's entries. By calling get and passing a key, the registry will filter it's entries based on the regular expressions listed in the whitelist and blacklist. Additionally, you can pass filter keys on top.

A whitelist/blacklist for one entry can have multiple regex statements.

Methods

| method | returns | desc | | --- | --- | --- | | register(id, data, filters = null, options = null) | ampersand-state | Register your data entry. id and data is required. Additionally you can pass a filters array and an options object. You can use options to pass meta information for later use. | | unregister(id) | null | Remove entry for id from registry. | | whitelistEntry: (id, regex = null) | null | Whitelist entry. If regex is null, /./ will be used. | | blacklistEntry: (id, regex = null) | null | Blacklist entry. If regex is null, /./ will be used. | | resetEntryWhitelist: (id) | null | Reset whitelist. | | resetEntryBlacklist: (id) | null | Reset blacklist. | | get: (key, filters = null, useAnd = false) | array[ampersand-state] | Returns an array of key matching entries. Additionally the list can be filtered by the passed array of strings. (see isFilterIncluded) | | isIncluded: (id, key, filters = [], useAnd = false) | boolean | Full passing check for one entry based on the passed key. Additionally you can extend the request by passing an array of filters. (see isFilterIncluded) | | isWhitelisted: (id, key) | boolean | Check if an entry is whitelisted based on the passed key. | | isBlacklisted: (id, key) | boolean | Check if an entry is blacklisted based on the passed key. | | isFilterIncluded: (id, filters = [], useAnd = false) | boolean | Check if an entry passes the filters array conditions. By default it will be true if one filters string matches (useAnd = false). If you set useAnd to true, the entry needs to have every of the passed filters in it's own filters list. |

Examples

Listing

r = new (require('filter_registry'))()

# register objects
r.register 'test1', { my: 'data' }
r.register 'test2', { my: 'data' }
r.register 'test3', { my: 'data' }
r.register 'test4', { my: 'data' }
r.register 'test5', { my: 'data' }

# define their visibility

r.whitelistEntry('test1') # will always show up
r.blacklistEntry('test2') # will never show up

r.whitelistEntry('test3', /^some\/.*/)
r.whitelistEntry('test4', /.*other$/)

r.whitelistEntry('test5')
r.blacklistEntry('test5', /^some\/.*/)

# get data

r.get('xyz')          # test1, test2, test5
r.get('some')         # test1, test2, test5
r.get('some/other')   # test1, test2, test3, test4

Filtering

r = new (require('filter_registry'))()

# register objects
r.register 'test1', { my: 'data' }
r.register 'test2', { my: 'data' }, []
r.register 'test3', { my: 'data' }, ['a']
r.register 'test4', { my: 'data' }, ['b']
r.register 'test5', { my: 'data' }, ['a', 'b']

r.whitelistEntry('test1')
r.whitelistEntry('test2')
r.whitelistEntry('test3')
r.whitelistEntry('test4')
r.whitelistEntry('test5')

# Use filters
r.get('xyz')                    # 1, 2, 3, 4, 5
r.get('xyz', [])                # 1, 2, 3, 4, 5
r.get('xyz', ['a'])             # 3, 5
r.get('xyz', ['a'], false)      # 3, 5
r.get('xyz', ['a'], true)       # 3, 5
r.get('xyz', ['a', 'b'])        # 3, 5
r.get('xyz', ['a', 'b'], false) # 3, 5
r.get('xyz', ['a', 'b'], true)  # 5