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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i require-json-ex

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • appetizermonster