Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@jswork/next-get-key

afeiship24MIT1.0.0

Get key by value.

next, get, value, key, kv

readme

next-get-key

Get key by value.

version license size download

installation

npm install -S @jswork/next-get-key

usage

import '@jswork/next-get-key';

const status = {
  error: -1,
  init: 0,
  play: 1,
  pause: 2,
  loaded: 3,
  ended: 4,
};

nxGetKey(status, -1);   // 'error'
nxGetKey(status, 0);    // 'init'
nxGetKey(status, 1);    // 'play'
nxGetKey(status, 2);    // 'pause'
nxGetKey(status, 3);    // 'loaded'
nxGetKey(status, 4);    // 'ended'

license

Code released under the MIT license.