1.0.0 • Published 3 years ago

@jswork/next-get-key v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

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.