UNPKG

arangojs

Version:

The official ArangoDB JavaScript driver.

36 lines 948 B
/** * ```ts * import type { * FulltextIndex, * GeoIndex, * MdiIndex, * PersistentIndex, * PrimaryIndex, * TtlIndex, * } from "arangojs/indexes.js"; * ``` * * The "indexes" module provides index-related types for TypeScript. * * @packageDocumentation */ /** * @internal */ export function _indexHandle(selector, collectionName) { if (typeof selector !== "string") { if (selector.id) { return _indexHandle(selector.id, collectionName); } throw new Error("Index handle must be a string or an object with an id attribute"); } if (selector.includes("/")) { const [head] = selector.split("/"); if (head !== collectionName) { throw new Error(`Index ID "${selector}" does not match collection name "${collectionName}"`); } return selector; } return `${collectionName}/${String(selector)}`; } //# sourceMappingURL=indexes.js.map