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

f--l

v1.0.2

Published

*foolishly simple bi-directional wildcards!*

Downloads

10

Readme

F--L

foolishly simple bi-directional wildcards!

For the single directional wildcard, ie: test t*st, we adapted matcher to work for node 0.10 up to 8+

In the quest for the bi-directional wildcard, we have found a solution in converting the 2 search terms to a 2d matrix, which we iterate through to find diagonals, this is an adaption of Levenshtein's distance algorithm with wildcards

quickstart


npm i f--l --save

var expect = require('expect.js');
var Fool = require('f--l');

var noFoolLikeA = new Fool({cache:1000});//caches replies, default is false

expect(noFoolLikeA.matches('*te*st/mat', '*t*e*s*t*')).to.be(true);
expect(noFoolLikeA.matches('*te*st/mat', '*te*st*')).to.be(true);
expect(noFoolLikeA.matches('*e*ma*', '*test/mat')).to.be(true);
expect(noFoolLikeA.matches('*i*g1', '*str*ing*')).to.be(true);
expect(noFoolLikeA.matches('*ing1', '*ring*')).to.be(true);
expect(noFoolLikeA.matches('*ing', 'test/long string*')).to.be(true);
expect(noFoolLikeA.matches('test/long string*', '*st*ing')).to.be(true);
expect(noFoolLikeA.matches('test/lo*', 'test/long string*')).to.be(true);
expect(noFoolLikeA.matches('*/test/match', '*st*')).to.be(true);
expect(noFoolLikeA.matches('*/test/match', '*st/blah')).to.be(false);
expect(noFoolLikeA.matches('*test/match', '/test/mar*')).to.be(false);
expect(noFoolLikeA.matches('/test/mat*', '*test/march')).to.be(false);
expect(noFoolLikeA.matches('*/short','/test/complex/and/short')).to.be(true);
expect(noFoolLikeA.matches('/test*/short','/test/complex/and/short')).to.be(true);
expect(noFoolLikeA.matches('*/short','/test/complex/and/long')).to.be(false);
expect(noFoolLikeA.matches('/test*/short','/test/complex/and/short/')).to.be(false);

//for more f***ing around, have a look at the tests

performance:

supported node versions:

v0.10 - v8

caveats

  • double wildcard matches are about 30% slower than single matches
  • synchronous/blocking (this may or may not be a caveat)
  • a wildcard is a placeholder for anything and nothing
  • this is quite experimental - if you want to use this to land aircraft or operate cranes, please test, test, test and get back to me if you find anything that doesnt work