Skip to content

Commit

Permalink
docs(jsonc): add module-level docs
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua committed Feb 26, 2024
1 parent 27517a8 commit b7c4d24
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
18 changes: 18 additions & 0 deletions jsonc/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

/**
* Provides tools for working with JSONC (JSON with comments).
*
* This module is browser compatible.
*
* @example
* ```ts Parsing JSONC
* import { parse } from "https://deno.land/std@$STD_VERSION/jsonc/mod.ts";
*
* parse('{"foo": "bar", } // comment'); // { foo: "bar" }
* parse('{"foo": "bar", } /* comment *\/'); // { foo: "bar" }
* parse('{"foo": "bar" } // comment', {
* allowTrailingComma: false,
* }); // { foo: "bar" }
* ```
*
* @module
*/
export * from "./parse.ts";
8 changes: 4 additions & 4 deletions jsonc/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export interface ParseOptions {
* ```ts
* import { parse } from "https://deno.land/std@$STD_VERSION/jsonc/mod.ts";
*
* console.log(parse('{"foo": "bar", } // comment')); // { foo: "bar" }
* console.log(parse('{"foo": "bar", } /* comment *\/')); // { foo: "bar" }
* console.log(parse('{"foo": "bar" } // comment', {
* parse('{"foo": "bar", } // comment'); // { foo: "bar" }
* parse('{"foo": "bar", } /* comment *\/'); // { foo: "bar" }
* parse('{"foo": "bar" } // comment', {
* allowTrailingComma: false,
* })); // { foo: "bar" }
* }); // { foo: "bar" }
* ```
*
* @param text A valid JSONC string.
Expand Down

0 comments on commit b7c4d24

Please sign in to comment.