Skip to content

Commit 9304ef0

Browse files
committed
docs: add Bun YAML API as an alternative to js-yaml
1 parent b4caff1 commit 9304ef0

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

docs/modules/js-yaml.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,18 @@
1111
[Project Page](https://eemeli.org/yaml/)
1212

1313
[npm](https://www.npmjs.com/package/yaml)
14+
15+
### Bun API
16+
17+
[Since Bun v1.2.21, YAML parsing is built in](https://bun.com/blog/release-notes/bun-v1.2.21#native-yaml-support) via the `YAML` namespace:
18+
19+
```js
20+
import { YAML } from "bun";
21+
22+
console.log(YAML.parse("123")); // 123
23+
console.log(YAML.parse("null")); // null
24+
console.log(YAML.parse("false")); // false
25+
console.log(YAML.parse("abc")); // "abc"
26+
console.log(YAML.parse("- abc")); // [ "abc" ]
27+
console.log(YAML.parse("abc: def")); // { "abc": "def" }
28+
```

0 commit comments

Comments
 (0)