UNPKG

@neo4j/cypher-builder

Version:

A programmatic API for building Cypher queries for Neo4j

39 lines (38 loc) 785 B
"use strict"; /* * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] */ Object.defineProperty(exports, "__esModule", { value: true }); exports.ListRange = void 0; exports.listRange = listRange; /** * @group Lists */ class ListRange { value; from; to; /** * @internal */ constructor(variable, from, to) { this.value = variable; this.from = from; this.to = to; } /** @internal */ getCypher(env) { return `${this.value.getCypher(env)}[${this.from}..${this.to}]`; } } exports.ListRange = ListRange; /** Adds a list range operator (`[ .. ]`) to an expression * @example * ```cypher * collect(var)[1..2] * ``` */ function listRange(expr, from, to) { return new ListRange(expr, from, to); }