Skip to main content
Module

x/rambda/source/nextIndex.spec.js

Faster and smaller alternative to Ramda
Go to Latest
File
import {nextIndex} from './nextIndex'
const list = [1, 2, 3, 4]
test('happy path', () => { expect(nextIndex(2, list)).toEqual(3)})
test('go back to the start', () => { expect(nextIndex(3, list)).toEqual(0)})
test('current index is too big', () => { expect(nextIndex(32, list)).toEqual(0)})