char/fjson

friendly JSON implementation in TypeScript

git clone https://git.t4t.associates/char/fjson

Charlotte Somrestructurebb03820

main
1.2 KiB43 linesraw
1/**
2 * config format: "friendly JSON" for TypeScript :D
3 * it is essentially JSON, except:
4 * - the root of a document may be an "implicit map"
5 * - simple ASCII identifier keys may be unquoted in maps
6 * - trailing commas are permitted in maps and arrays
7 * - commas can be replaced by newlines in maps and arrays
8 * - strings may be single-quoted
9 * - documents may contain `// comments`
10 *
11 * ```ts
12 * import { parse, stringify } from "./mod.ts";
13 * const value = parse("name: 'demo'\nactive: true");
14 * // => { "name": "demo", "active": true }
15 * ```
16 */
17export { FjsonError } from "./errors.ts";
18export type { FjsonErrorKind, Span } from "./errors.ts";
19export { DEFAULT_MAX_DEPTH, resolveMaxDepth } from "./options.ts";
20export type { Options } from "./options.ts";
21export {
22  nodeToValue,
23  parse,
24  parseObject,
25  parseObjectTree,
26  parseTree,
27} from "./parse.ts";
28export { stringify } from "./stringify.ts";
29export { apply, applyWith } from "./apply.ts";
30export { Document } from "./document.ts";
31export type { PathSegment } from "./document.ts";
32export type {
33  ArrayNode,
34  BoolNode,
35  JsonObject,
36  JsonValue,
37  NullNode,
38  NumberNode,
39  ObjectMember,
40  ObjectNode,
41  StringNode,
42  SyntaxNode,
43} from "./parse.ts";