A JavaScript/TypeScript library for parsing and querying the KDL Document Language (v0.3.0). Provides a parse() function returning an AST of nodes, and a query() function for CSS-selector-like traversal. Unlike generic YAML/TOML parsers, it natively handles KDL-specific features like type-annotated values, interspersed properties/values, and node tags. Ships TypeScript types. Release cadence is irregular; the package is relatively stable but may break on future KDL spec changes.
npm install kdljsVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing a simple KDL document with nested nodes and string values, showing the resulting AST structure.
Iterate over the resulting array or access by index; do not assume a single root object.
Check array length instead of truthiness; handle empty arrays.
Use const { parse, query } = require('kdljs');Always check array emptiness or use optional chaining; do not rely on undefined for missing fields.
Use typeof to differentiate value types; type annotations are only preserved in tags.
Install @kdl-org/kdljs-types if separate; ensure tsconfig.json has 'moduleResolution': 'node' or 'bundler'.
Use import { parse } from 'kdljs';Ensure correct import: import { query } from 'kdljs';parse returns an array, so use Array.isArray check or directly iterate.
No dependency data recorded yet.