Skip to content

Commit

Permalink
First stab at TOML support, closes #93
Browse files Browse the repository at this point in the history
  • Loading branch information
LeaVerou committed Jul 15, 2024
1 parent 7d8852d commit f1b62b8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions formats/toml/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TOML Format

Uses the [`smol-toml`](https://www.npmjs.com/package/smol-toml) npm package.
17 changes: 17 additions & 0 deletions formats/toml/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Format from "../../src/format.js";
import { parse, stringify } from "../../node_modules/smol-toml/dist/index.js";

export default class TOML extends Format {
static extensions = ["toml"];
static mimeTypes = ["application/toml"];

static parse (str, options) {
options = this.resolveOptions(options, "parse");
return parse(str, options);
}

static stringify (obj, options) {
options = this.resolveOptions(options, "stringify");
return stringify(obj, options);
}
}
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
},
"dependencies": {
"csv": "^6.3.1",
"smol-toml": "^1.2.2",
"urlpattern-polyfill": "^10.0.0",
"yaml": "^2.3.1"
}
Expand Down

0 comments on commit f1b62b8

Please sign in to comment.