MCPcopy Create free account
hub / github.com/breck7/scroll / getNextOrPrevious

Method getNextOrPrevious

external/.scrollLibs.js:14225–14231  ·  view source on GitHub ↗
(arr, item)

Source from the content-addressed store, hash-verified

14223 return filename
14224 }
14225 static getNextOrPrevious(arr, item) {
14226 const length = arr.length
14227 const index = arr.indexOf(item)
14228 if (length === 1) return undefined
14229 if (index === length - 1) return arr[index - 1]
14230 return arr[index + 1]
14231 }
14232 static toggle(currentValue, values) {
14233 const index = values.indexOf(currentValue)
14234 return index === -1 || index + 1 === values.length ? values[0] : values[index + 1]

Callers

nothing calls this directly

Calls 1

indexOfMethod · 0.80

Tested by

no test coverage detected