# @ray4105/js-yaml

> YAML 1.2 parser and serializer

Latest version **3.13.1** (published 2020-04-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ray4105/js-yaml
pnpm add @ray4105/js-yaml
yarn add @ray4105/js-yaml
bun add @ray4105/js-yaml
```

Provides the command `js-yaml`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.13.1 |
| Published | 2020-04-02 |
| First published | 2020-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 273.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6642 |
| Author | Vladimir Zapparov |
| Maintainers | ray4105 |
| Keywords | yaml, parser, serializer, pyyaml |

## Links

- npm: https://www.npmjs.com/package/@ray4105/js-yaml
- Repository: https://github.com/nodeca/js-yaml
- Issues: https://github.com/nodeca/js-yaml/issues
- npm.io page: https://npm.io/package/@ray4105/js-yaml

## Dependencies (2)

- [esprima](https://npm.io/package/esprima.md) ^4.0.0
- [argparse](https://npm.io/package/argparse.md) ^1.0.7

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 3.13.1 (latest) — 2020-04-02

## README

JS-YAML-tweaked for transpiling my syntax highlighting extension
=================================================

I've just copied [JS-YAML here](https://github.com/nodeca/js-yaml), and tweaked the `readBlockScalar` function in `lib/js-yaml/loader.js` from this:  

```javascript
    if (didReadContent) { // i.e. only if we have already read some scalar content.
      state.result += ' ';
    }
```

to this:

```javascript
    // don't want the space added at each eol in a block scalar,
    // so that we can write pure long regex spreading over multiple lines
    // without the labor pains to escape the '\'
    // 2020/03/30 20:22 Ray
    if (didReadContent && chomping !== CHOMPING_STRIP) {
      state.result += ' ';
    }
```


And now we can do this:  

```yaml
  - name: storage.type.function.rexx
    match: >-
      ^\s*
      [A-Za-z@#$!?_]
      [A-Za-z@#$!?_0-9]*
      :
```

and `js-yaml` will generate this:

```json
  [
    {
      "name": "storage.type.function.rexx",
      "match": "^\\s*[A-Za-z@#$!?_][A-Za-z@#$!?_0-9]*:"
    }
  ]
```
  

Notice how no space added after `*`, `]` and `:` at the end of line.
  

All rights reserved for `js-yaml`.

---
_Source: https://npm.io/package/@ray4105/js-yaml · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
