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

kevent

v1.0.0

Published

Keyboard event manager

Readme

kevent

keyboard event handler

Usage:

import { kevent } from 'https://unpkg.com/[email protected]/index.js'

const on = kevent()

on.keypress.ctrl.shift.k(() => {
  console.log('keypress: ctrl+shift+k')
})

// But keypress is the default event so we can omit it
on.ctrl.shift.k(() => {
  console.log('keypress: ctrl+shift+k')
})

// Most letter keys can be uppercase so we can omit shift
on.ctrl.K(() => {
  console.log('keypress: ctrl+shift+k')
})

on.default.ctrl.K(e => {
  console.log('keypress: ctrl+shift+k')
  // you can now manualy call, or not e.preventDefault
})

// It is possible to share base arguments
const shortcut = kevent().default.meta.keydown

shortcut.tab(() => console.log('keydown meta+tab without prevent default'))
shortcut.L(() => console.log('keydown meta+shift+l without prevent default'))

// For now you have only one option:
const { keydown, keyup } = kevent({
  elem: document.getElementById('elem') // dom element to attach to
  // defaults to window
})

// It is possible to use directly the keyCode if you want
keydown[13](() => console.log('key 13 down (enter)'))
keyup[13](() => console.log('key 13 up (enter)'))

// Because 0-9 can be both the num row or keycodes
// they are aliased from _0 to _9
keyup._1(() => console.log('numrow 1 pressed'))

// Shifted aliases are based on QWERTY layout
keyup['!'](() => console.log('shift + numrow 1 pressed'))

// Of course you can always expand to
keyup.shift._1(() => console.log('shift + numrow 1 pressed'))

All keys available are

  • A-Z (lower and upper, from .charCodeAt)
  • 0-9 (aliased to _0 and _9)
  • f1-f24
  • numpad0-numpad9

Read definition.js for the complete list.