# jsonc-require

> jsonc for require(), similar to the one used by VS Code.

Latest version **1.0.1** (published 2021-04-23) · MIT license · 0 weekly downloads

## Install

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

## 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.1 |
| Published | 2021-04-23 |
| First published | 2019-04-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 1 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | aMarCruz |
| Maintainers | amarcruz |
| Keywords | json, jsonc, comments, require, vscode |

## Links

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

## Dependencies (1)

- [perf-regexes](https://npm.io/package/perf-regexes.md) ^1.0.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

- 1.0.1 (latest) — 2021-04-23
- 1.0.0 — 2021-02-17
- 0.1.1 — 2019-04-09
- 0.1.0 — 2019-04-08

## README

# jsonc-require

[![License][license-badge]][license-url]
[![npm Version][npm-badge]][npm-url]

jsonc for `require`, similar to the one used by VS Code.

- Transparently loads json files with comments.
- Strips trailing commas\*
- Strips UTF-8 BOM.

\* As in VS Code, double commas raises a SyntaxError.

**Note:**

jsonc-require v1.0.1 and above supports the `.jsonc` extension, in addition to `.json` (thanks to @tacc-wbomar)

## Install

```bash
npm install jsonc-require -S
# or
yarn add jsonc-require
```

## Usage

```js
// `require` once the jsonc-require module
require('jsonc-require')

// ...and use it everywhere.
const data = require('./mydata.json')
// const data = require('./mydata.jsonc')
```

Tip: Use `import` instead `require` if you are using ES6 modules.

## TODO

- [x] Test
- [ ] Enhance the Readme

## Support my Work

I'm a full-stack developer with more than 20 year of experience and I try to share most of my work for free and help others, but this takes a significant amount of time and effort so, if you like my work, please consider...

[<img src="https://amarcruz.github.io/images/kofi_blue.png" height="36" title="Support Me on Ko-fi" />][kofi-url]

Of course, feedback, PRs, and stars are also welcome 🙃

Thanks for your support!

## License

The [MIT](LICENSE) License &copy; 2019-2021 Alberto Martínez

[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat
[license-url]: https://github.com/aMarCruz/jsonc-require/blob/master/LICENSE
[npm-badge]: https://img.shields.io/npm/v/jsonc-require.svg
[npm-url]: https://www.npmjs.com/package/jsonc-require
[kofi-url]: https://ko-fi.com/C0C7LF7I

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