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

stringify-key

v0.1.2

Published

Stringifies key objects emitted by nodejs readline (http://nodejs.org/api/readline.html).

Readme

stringify-key build status

Stringifies key objects emitted nodejs readline.

Installation

npm i stringify-key

Usage

  var stringifyKey = require('stringify-key');

  var key =  { name: 'c', ctrl: true, meta: false, shift: false };
  console.log(stringifyKey(key)); // ctrl-c

  key =  { name: 'c', ctrl: true, meta: true, shift: true };
  console.log(stringifyKey(key)); // shift-meta-ctrl-c

Limitations

Although the algorithm works for all keys, the readline module doesn't work consistent in all terminals. For example, on a Mac Lion xTerm the meta key is never registered.

Meta

As just stated the meta key is not registered (at least in xTerm), however if present, stringify-key will take it into account.

Ctrl

The ctrl key seems to work properly in readline, except for the following:

  • ctrl-i interpreted as tab
  • ctrl-h interpreted as backspace
  • ctrl-j and ctrl-m, both interpreted as enter
  • ctrl-[;',/] are also not interpreted correctly

Shift

The shift-letter is correctly registered as well, however pressing ctrl-shift and a letter together registers ctrl only. Here is the most likely cause for the latter, since letters are never uppercased when ctrl is pressed.

Alt

There is no code inside the readline module that registers pressing the alt key.
Pressing alt in conjunction with a letter is used to enter characters otherwise not available on the keyboard, i.e. alt-p prints π.

However if an alt : true is part of the passed key object, it is considered by stringify-key.

Moral

I'm not sure if the problems unexplained problems above are caused by an incorrect implemention in readline or the underlying terminal. I suggest to investigate the readline source in order to get more information and/or fix problems.

However, the moral is to expect unexpected results (npi) when using stringify-key for keys emitted by readline.