summaryrefslogtreecommitdiff
path: root/std/encoding
diff options
context:
space:
mode:
authorCh3ri0ur <22932267+Ch3ri0ur@users.noreply.github.com>2020-06-09 21:08:38 +0200
committerGitHub <noreply@github.com>2020-06-09 15:08:38 -0400
commitbad6f2b224a92e3bf5cdaf5f8cbc700cb0f9de04 (patch)
tree1eaa79ba09c5e2767fd679bcaef119f0c01e0100 /std/encoding
parent8366f36873bb7311f533e5e49d9ad13581b0b5c1 (diff)
Readme cleanup in encoding and ws (#6209)
Diffstat (limited to 'std/encoding')
-rw-r--r--std/encoding/README.md45
1 files changed, 29 insertions, 16 deletions
diff --git a/std/encoding/README.md b/std/encoding/README.md
index 50db5364f..15c8c40bf 100644
--- a/std/encoding/README.md
+++ b/std/encoding/README.md
@@ -77,6 +77,7 @@ function is as follows:
### Usage
```ts
+import { parse } from "https://deno.land/std/encoding/csv.ts";
const string = "a,b,c\nd,e,f";
console.log(
@@ -182,24 +183,10 @@ will output:
}
```
-### Usage
-
-#### Parse
-
-```ts
-import { parse } from "./parser.ts";
-import { readFileStrSync } from "../fs/read_file_str.ts";
-
-const tomlObject = parse(readFileStrSync("file.toml"));
-
-const tomlString = 'foo.bar = "Deno"';
-const tomlObject22 = parse(tomlString);
-```
-
-#### Stringify
+### Basic usage
```ts
-import { stringify } from "./parser.ts";
+import { parse, stringify } from "https://deno.land/std/encoding/toml.ts";
const obj = {
bin: [
{ name: "deno", path: "cli/main.rs" },
@@ -208,6 +195,32 @@ const obj = {
nib: [{ name: "node", path: "not_found" }],
};
const tomlString = stringify(obj);
+console.log(tomlString);
+
+// =>
+// [[bin]]
+// name = "deno"
+// path = "cli/main.rs"
+
+// [[bin]]
+// name = "deno_core"
+// path = "src/foo.rs"
+
+// [[nib]]
+// name = "node"
+// path = "not_found"
+
+const tomlObject = parse(tomlString);
+console.log(tomlObject);
+
+// =>
+// {
+// bin: [
+// { name: "deno", path: "cli/main.rs" },
+// { name: "deno_core", path: "src/foo.rs" }
+// ],
+// nib: [ { name: "node", path: "not_found" } ]
+// }
```
## YAML