https://github.com/sunnyadn/js-toml
A TOML parser for JavaScript, fully compliant with TOML 1.0.0 Spec. Support Node.js, browsers and Bun⚡️!
https://github.com/sunnyadn/js-toml
bun cjs esm javascript nodejs toml toml-parser typescript
Last synced: about 1 year ago
JSON representation
A TOML parser for JavaScript, fully compliant with TOML 1.0.0 Spec. Support Node.js, browsers and Bun⚡️!
- Host: GitHub
- URL: https://github.com/sunnyadn/js-toml
- Owner: sunnyadn
- License: mit
- Created: 2022-11-04T04:40:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-23T23:17:16.000Z (over 1 year ago)
- Last Synced: 2025-03-31T08:07:59.958Z (about 1 year ago)
- Topics: bun, cjs, esm, javascript, nodejs, toml, toml-parser, typescript
- Language: TypeScript
- Homepage:
- Size: 531 KB
- Stars: 42
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# js-toml
[](https://codecov.io/github/sunnyadn/js-toml)
[](https://github.com/sunnyadn/js-toml/actions)
[](https://opensource.org/licenses/MIT)
[](https://badge.fury.io/js/js-toml)
A TOML parser for JavaScript and TypeScript. Fully tested and 100% compatible with the TOML v1.0.0 spec.
Support Node.js, browsers and Bun⚡️!
## Installation
```bash
npm install js-toml
```
or with yarn
```bash
yarn add js-toml
```
or with pnpm
```bash
pnpm add js-toml
```
even support bun!
```bash
bun add js-toml
```
## Usage
```typescript
import {load} from 'js-toml';
const toml = `
title = "TOML Example"
[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00 # First class dates
`;
const data = load(toml);
console.log(data);
```
## API
### load(toml: string): object
Parses a TOML string and returns a JavaScript object.
### dump(object: object): string
Under development.
## License
MIT
## References
[TOML v1.0.0 Official Specs](https://toml.io/en/v1.0.0)
[TOML GitHub Project](https://github.com/toml-lang/toml)
[TOML Test](https://github.com/toml-lang/toml-test)
[iarna-toml](https://github.com/iarna/iarna-toml)