require-json-ex

1.0.2 • Public • Published

require-json-ex

require for JSON with Comments, which supports relative path as argument!

Install

npm i --save require-json-ex

Usage

  • config.json

    {
      "key": {
        "something": "value"      // Single-line Comment
      }
      /* Multi-line Comment */
    }
  • example.js

    const requireJSON = require('require-json-ex');
    const config = requireJSON('./config.json');
    
    console.log(config.key);

API

requireJSON(path)

  • path String - Absolute or Relative Path like using require

Known Issues

  • Relative path isn't supported if script is running on Jest

License

MIT

Package Sidebar

Install

npm i require-json-ex

Weekly Downloads

3

Version

1.0.2

License

MIT

Last publish

Collaborators

  • appetizermonster