MCPcopy Create free account
hub / github.com/editablejs/editable / wrapArray

Function wrapArray

packages/ui/src/menu.tsx:940–942  ·  view source on GitHub ↗

* Wraps an array around itself at a given start index * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`

(array: T[], startIndex: number)

Source from the content-addressed store, hash-verified

938 * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`
939 */
940function wrapArray<T>(array: T[], startIndex: number) {
941 return array.map((_, index) => array[(startIndex + index) % array.length])
942}
943
944/**
945 * This is the "meat" of the typeahead matching logic. It takes in all the values,

Callers 1

getNextMatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…