parse-key
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/parse-key package

0.2.1 • Public • Published

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, sequence: '\u0003' }
 
parse('shift-ctrl-c') // returns { name: 'c', ctrl: true, meta: false, shift: true, alt: false, sequence: '\u0003' }
 
parse('alt-c')        // returns { name: 'c', ctrl: false, meta: false, shift: false, alt: true, sequence: 'c' }

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.1
    23,681
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.1
    23,681
  • 0.2.0
    1
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i parse-key

Weekly Downloads

23,682

Version

0.2.1

License

MIT

Last publish

Collaborators

  • thlorenz