Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 12 hours 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 (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-23T23:17:16.000Z (about 1 month ago)
- Last Synced: 2024-11-24T00:19:09.553Z (about 1 month ago)
- Topics: bun, cjs, esm, javascript, nodejs, toml, toml-parser, typescript
- Language: TypeScript
- Homepage:
- Size: 531 KB
- Stars: 32
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# js-toml
[![codecov](https://codecov.io/github/sunnyadn/js-toml/branch/main/graph/badge.svg?token=8LNJGG767J)](https://codecov.io/github/sunnyadn/js-toml)
[![github actions](https://github.com/sunnyadn/js-toml/workflows/CI/badge.svg)](https://github.com/sunnyadn/js-toml/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![npm version](https://badge.fury.io/js/js-toml.svg)](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)