Skip to content

Commit

Permalink
docs(jsonc): add module-level docs (#4402)
Browse files Browse the repository at this point in the history
* docs(jsonc): add module-level docs

* Yoshiya's suggestion
  • Loading branch information
iuioiua authored Feb 27, 2024
1 parent 4bcdea8 commit 3736b01
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
20 changes: 20 additions & 0 deletions jsonc/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
// 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). Currently, this
* module only provides a means of parsing JSONC. JSONC serialization is not
* yet supported.
*
* 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 3736b01

Please sign in to comment.