map-util
Simple set of utilities that make getting the previous or next value in a map easier.
Install
$ npm install [--save] map-util
Usage
'use strict' const utils = const nextVal = utilsnextValconst prevVal = utilsprevVal const map = mapmap // => '2' // => null// If we want to wrap around: // => '1' // => '1' // => null// If we want to wrap around: // => '2' // or to get first and lastutils // => ['1', '1']utils // => '1'utils // => '1' utils // => ['2', '2']utils // => '2'utils // => '2' // Replace the key with another key, but keep the valueutilsconsole// => '2'
Test
$ npm test
Author
Evan Lucas
License
MIT (See LICENSE
for more info)