Socket
Socket
Sign inDemoInstall

json2module

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    json2module

Convert a JSON object to an ES6 module.


Version published
Weekly downloads
133K
decreased by-1.43%
Maintainers
1
Install size
43.1 kB
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 14 Mar 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc