# jsonc-metadata

> Extract field metadata from comments in JSONC files.

Latest version **0.1.0** (published 2020-10-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsonc-metadata
pnpm add jsonc-metadata
yarn add jsonc-metadata
bun add jsonc-metadata
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2020-10-01 |
| First published | 2020-09-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| Author | Sarath KCM |
| Maintainers | sarathkcm |
| Keywords | jsonc, comments, metadata |

## Links

- npm: https://www.npmjs.com/package/jsonc-metadata
- Repository: https://github.com/sarathkcm/jsonc-metadata
- Homepage: https://github.com/sarathkcm/jsonc-metadata#readme
- Issues: https://github.com/sarathkcm/jsonc-metadata/issues
- npm.io page: https://npm.io/package/jsonc-metadata

## Dependencies (2)

- [js-yaml](https://npm.io/package/js-yaml.md) 3.14.0
- [jsonc-parser](https://npm.io/package/jsonc-parser.md) ^2.3.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.0 (latest) — 2020-10-01
- 0.0.5 — 2020-09-28
- 0.0.4 — 2020-09-26

## README

## JSONC-METADATA
Extract field metadata from comments in JSONC files.

JSONC is JSON with comments. This library helps in extracting metadata for each field from comments.

>Depends on `jsonc-parser` library from microsoft for parsing jsonc.

### Usage
```js
import { parse, yamlCommentParser }  from "jsonc-metadata";


const jsonc = `{
        // this is the name
        "name": "JSONC",

        // this is tags
        "tags" : [
            "library",
            "node",
            "comments"
        ],
    }`;

    const metadata = parse(jsonc); 
    /*
        {
            "name": ["this is the name"],
            "tags": ["this is tags"]
        }
    */


    const jsoncWithYamlComments = `{
        // message: this is name field
        "name": "JSONC",

        // message: these are tags
        "tags" : [
            "library",
            "node",
            "comments"
        ],
    }`;

    const metadata2 = parse(jsonc, yamlCommentParser); 
    
    /* 
        { 
            "name": {
                "message": "this is the name"
            }, 
            "tags": {
                "message" : "these are tags" 
            }
        }
    */

```

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