1.0.2 • Published 8 years ago

require-json-ex v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

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