# node-yaml-path

> >[!CAUTION] > DEPRECATED: This package was replaced by https://www.npmjs.com/package/@alell/jsonpath-plus-q > Simple yaml-path to `yaml` library.

Latest version **1.0.4** (published 2024-07-01) · SEE LICENSE IN LICENCE license · 0 weekly downloads

## Install

```sh
npm install node-yaml-path
pnpm add node-yaml-path
yarn add node-yaml-path
bun add node-yaml-path
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2024-07-01 |
| First published | 2022-03-09 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENCE |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=14.0.0 |
| Dependencies | 1 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alan S. Ferreira |

## Links

- npm: https://www.npmjs.com/package/node-yaml-path
- Repository: https://github.com/alansferreira/node-yaml-path
- Homepage: https://github.com/alansferreira/node-yaml-path#readme
- Issues: https://github.com/alansferreira/node-yaml-path/issues
- npm.io page: https://npm.io/package/node-yaml-path

## Dependencies (1)

- [yaml](https://npm.io/package/yaml.md) 2.0.0-10

## Recent versions

- 1.0.4 (latest) — 2024-07-01
- 1.0.3 — 2022-03-10
- 1.0.2 — 2022-03-09
- 1.0.1 — 2022-03-09
- 1.0.0 — 2022-03-09

## README

# node-yaml-path
>[!CAUTION]
> DEPRECATED: This package was replaced by https://www.npmjs.com/package/@alell/jsonpath-plus-q
>
Simple yaml-path to `yaml` library.

## Using `get`

```ts
import { Document, parseDocument } from 'yaml'
import { get, set } from 'node-yaml-path'

const yaml = `
metadata: 
  annotations: 
    simple-annotation: "string value"
`
doc = parseDocument(content)
const path = '$.metadata.annotations.simple-annotation'
const result = get(path, doc)
console.log(result)
// > 'string value'

```

## Using `set`

```ts
import { Document, parseDocument } from 'yaml'
import { get, set } from 'node-yaml-path'

const yaml = `
metadata: 
  annotations: 
    simple-annotation: "string value"
`

const newValue = 'new string value'
set(path, newValue, doc)
const newDoc = parseDocument(doc.toString())
const newResult = get(path, newDoc)
console.log(newResult)
// > 'new string value'

console.log(newDoc.toString())
// > '
//   metadata: 
//     annotations: 
//       simple-annotation: "new string value"
'

```

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