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

funkey

v1.0.3

Published

A functional keyboard event handler.

Readme

funkey CircleCI npm Coverage Status

Funkey is a self-currying keyboard event handler. ~~You provide the keyboard event, funkey provides the fun.~~ http://bukk.it/hahano.png

Download

Direct: Build (minified)

Using npm:

$ npm i --save funkey

Basic Usage

document.addEventListener('keydown', (event) => {
  funkey(event, 'super+enter', () => { 
    console.log('super enter pressed!');
  });
})

Arguments

  • keyboardEvent - A keyboard event to handle.
  • keyName - The keyboard key combination to match.
  • callback - A callback to invoke with event if keyName matches event.

The KeyName

The keyName is made up of the modifiers and the key itself. The available modifiers are ctrl, alt, shift and super. The available key names are a single character, or a named key, which may be one of:

f1-12, tab, backspace, enter, shift, pause, capslock, escape, space, pageup, pagedown, end, home, left, up, right, down, insert, delete, select, multiply, add, subtract, decimal, divide, numlock, scrolllock, numpad0-9

Currying

Funkey is self-currying and the keyboard event argument can be given in any position when invoking funkey. This makes funkey pretty flexible. Here are some examples:

document.addEventListener('keydown', (event) => {
  var onKeypress = funkey(event);
  onKeypress('super+enter', (e) => { /* take action! */ });
  onKeypress('super+esc', (e) => { /* escape! */ });
  onKeypress('shift+ctrl+super+s', (e) => { /* ¯\_(ツ)_/¯ */ });
})
var onEnterDoStuff = funkey('enter', () => { /* do stuff */ });
var onEscapeDoOtherStuff = funkey('escape', () => { /* do other stuff */ });

document.addEventListener('keydown', (event) => {
  onEnterDoStuff(event);
  onEscapeDoOtherStuff(event);
});
var logMessage = () => console.log('hello world!');
var onShiftDown = funkey('shift+down');
document.addEventListener('keydown', onShiftDown(logMessage));

The callback context is also correctly maintained:

const controller = {
  doSomething: function() {},
  onKey: funkey('shift+/', function() {
    this.doSomething();
  })
};

document.addEventListener('keydown', controller.onKey.bind(controller));

Roadmap

  • [x] Improved docs
  • [ ] Impliment newer KeyboardEvent.key property parsing.

References

Inspiration and sources.

Contributing

Don't be shy! Submit issues (or better yet PRs) if you see anything that could be better. If you're submitting code that contains patches or features please try to include unit tests. Thanks!

Author

Piet van Zoen [email protected]

License

MIT : http://opensource.org/licenses/MIT