lazy-json: 用于 require 含有注释的 json 文件

1,311 阅读1分钟

JavaScript

README.md

lazy-json makes it happen to require JSON file with comments in it.

Install

npm install --save lazy-json

Example

// test.lazy.json
{
  // here is my comments
  "github": "oriented programming"
  /* things all done
  ** go home
  */
}

// usage
import { requireJSON } from 'lazy-json'
const obj = requireJSON('./test.lazy')
console.log(obj.github)

Related

License

MIT © EGOIST