Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

require-strip-json-comments

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-strip-json-comments

Require .json files with comments

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

require-strip-json-comments Build Status

Require .json files with comments.

For advanced JSON syntax I recomend using require-json5, which can load JSON with trailing commas, unquoted keys, hex numbers, comments, and more.

Install

npm i require-strip-json-comments

Usage

  1. Load a JSON file which contains comments
var requireJSON = require('require-strip-json-comments');
var config = requireJSON("./config.json");
  1. Parse a JSON string which contains comments
var requireJSON = require('require-strip-json-comments');
var config = requireJSON.parse('{"name": /*a very important option*/ "value"}');
  1. Replace require()
require('require-strip-json-comments').replace_require();
var config = require("./config");
  1. Replace JSON.parse()
require('require-strip-json-comments').replace_JSON();
var config = JSON.parse('{"name": /*a very important option*/ "value"}');
  1. Replace require() and JSON.parse()
require('require-strip-json-comments').replace();
// ...

Keywords

FAQs

Package last updated on 17 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc