json2module
Convert a JSON object to an ES6 module.
Last updated 9 years ago by mbostock .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ npm install json2module 
SYNC missed versions from official npm registry.

json2module

Convert a JSON object into an ES6 module. For example, given a package.json file:

{
  "name": "hello-world",
  "version": "0.0.1"
}

If you run this through json2module like so:

json2module < package.json

You’ll get the following ES6 module as output:

export var name = "hello-world";
export var version = "0.0.1";

This is particularly useful for exporting a version number defined in your package.json file when using Rollup. Unlike rollup-plugin-json, which enables Rollup to parse JSON directly, json2module creates standard ES6 modules that can be consumed by any client.

Current Tags

  • 0.0.3                                ...           latest (9 years ago)

3 Versions

  • 0.0.3                                ...           9 years ago
  • 0.0.2                                ...           9 years ago
  • 0.0.1                                ...           9 years ago
Maintainers (1)
Downloads
Total 5
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
  • rw ^1.3.2
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE