json2module
    Overview
    Documentation
    Tutorials
    Insights
    Code
    Dependencies
    Contributors
    Jobs

json2module

Convert a JSON object to an ES6 module.

0.0.3  •  Updated 4 years ago  •  by Mike Bostock  •  BSD 3-Clause "New" or "Revised" License

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.

Popularity

Weekly Downloads
22.1K
Stars
17

Maintenance

Development

Last ver 4 years ago
Created 4 years ago
Last commit 4 years ago
25 minutes between commits

Technology

Node version: 5.7.0
0 unpacked

Compliance

BSD 3-Clause "New" or "Revised" License
OSI Approved
0 vulnerabilities

Contributors

1 contributors
Mike Bostock
Maintainer, 6 commits
Works at observablehq

Dependencies

Tags

json
es6
module
Openbase helps developers choose among and use millions of open-source packages, so they can build amazing products faster.
FacebookTwitterLinkedIn
© 2020 Devstore, Inc.