# prefixIndex

> **prefixIndex**(`input`): [`PrefixIndex`](/reference/knotkit/prefix-index/interfaces/prefixindex/)

Defined in: [packages/prefix-index/src/prefix-index.ts:26](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/prefix-index/src/prefix-index.ts#L26)

Snapshot an iterable of strings as sorted, distinct keys. Keys compare by UTF-16 code units. Build takes expected O(n) set operations for n input keys and O(u log(u + 1)) comparisons for u distinct keys. Retained space is O(u), excluding the strings themselves. Errors from the input iterable propagate.

## Parameters

### input

`Iterable`<`string`>

## Returns

[`PrefixIndex`](/reference/knotkit/prefix-index/interfaces/prefixindex/)
