Cypher.js
nodejs c++ addon to parse cypher query to AST
Install / Use
/learn @tungv/Cypher.jsREADME
cypher.js
Utilities to parse, transform and format cypher query. Inspired by node-cypher-parser with 3 main differences:
- this package can handle long query (longer than 1024 characters)
- this package doesn't rename
node.typefromlibcypher-parser - this package will eventually include a
formatutility to print an AST back to a string.
APIs
1. parse(query)
Accepts a cypher query string and try to parse it to Abstract Syntax Tree using native libcypher-parser.
Example:
const { parse } = require('cypher.js');
const result = parse("MATCH (n) RETURN n");
> console.log(require('util').inspect(result, { depth: null }))
/*
{ nnodes: 10,
eof: false,
errors: [],
root:
{ type: 'statement',
body:
{ type: 'query',
clauses:
[ { type: 'match',
optional: false,
pattern:
{ type: 'pattern',
paths:
[ { type: 'pattern-path',
elements:
[ { type: 'node-pattern',
identifier: { type: 'identifier', name: 'n' },
labels: [] } ] } ] },
hints: [] },
{ type: 'return',
distinct: false,
includeExisting: false,
projections:
[ { type: 'projection',
expression: { type: 'identifier', name: 'n' } } ] } ],
options: [] },
options: [] } }
*/
2. format(root, transform)
Stability: experimental
Accepts a AST root and and optional transform function and returns a reformatted string.
Example:
const { parse, UNSTABLE__format } = require('cypher.js');
const result = parse('MATCH (n) RETURN n');
const reformatted = UNSTABLE__format(result.root);
// reformatted = "MATCH (n)\nRTURN n;"
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
