MCPcopy Create free account
hub / github.com/cursorless-dev/cursorless / parityNodeFinder

Function parityNodeFinder

src/languages/clojure.ts:27–32  ·  view source on GitHub ↗

* Picks a node by rounding down and using the given parity. This function is * useful for picking the picking eg the key in a sequence of key-value pairs * @param parentFinder The finder to use to determine whether the parent is a * match * @param parity The parity that we're looking for * @ret

(parentFinder: NodeFinder, parity: 0 | 1)

Source from the content-addressed store, hash-verified

25 * @returns A node finder
26 */
27function parityNodeFinder(parentFinder: NodeFinder, parity: 0 | 1) {
28 return indexNodeFinder(
29 parentFinder,
30 (nodeIndex: number) => Math.floor(nodeIndex / 2) * 2 + parity
31 );
32}
33
34function mapParityNodeFinder(parity: 0 | 1) {
35 return parityNodeFinder(patternFinder("map_lit"), parity);

Callers 1

mapParityNodeFinderFunction · 0.85

Calls 1

indexNodeFinderFunction · 0.85

Tested by

no test coverage detected