开发者社区> 镜像站> NPM> parse-key
parse-key
Parses strings into key objects of the same format as the ones emitted by nodejs readline.
Last updated 8 years ago by thlorenz .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install parse-key 
SYNC missed versions from official npm registry.

parse-key build status

Parses strings into key objects of the same format as the ones emitted by nodejs readline.

Counter part to stringify-key.

Installation

npm i parse-key

Usage

var parse = require('parse-key');

parse('ctrl-c')       // returns { name: 'c', ctrl: true, meta: false, shift: false, alt: false }

parse('shift-ctrl-c') // returns { name: 'c', ctrl: true, meta: false, shift: true, alt: false }

parse('alt-c')        // returns { name: 'c', ctrl: false, meta: false, shift: false, alt: true }

Caveats

For completeness' sake, the alt modifier is parsed and included with the returned key although the nodejs readline does not include it in its key object nor does it have any effect when the key is emitted.

Current Tags

  • 0.2.1                                ...           latest (8 years ago)

4 Versions

  • 0.2.1                                ...           8 years ago
  • 0.2.0                                ...           8 years ago
  • 0.1.1                                ...           8 years ago
  • 0.1.0                                ...           8 years ago