UNPKG

@dillonkearns/elm-graphql

Version:

<img src="https://cdn.jsdelivr.net/gh/martimatix/logo-graphqelm/logo.svg" alt="dillonearns/elm-graphql logo" width="40%" align="right">

14 lines (9 loc) 350 B
// @flow import {curry} from "flow-static-land/lib/Fun"; import isLastIndex from "./isLastIndex"; /** * Returns 0 if current index is the last one, or returns next if it is not. */ const cycleNext = (array: Array<any>, currentIndex: number): number => isLastIndex(array, currentIndex) ? 0 : currentIndex + 1; export default curry(cycleNext);