cjs2es6export

0.2.1 • Public • Published

cjs2es6export

Convert a subset of CommonJS/NodeJS module.exports assignments to ECMAScript 6 module export declarations.

Usage:

var cjs2es6export = require('cjs2es6export');

var src = "module.exports = function() { return 42; };"
var newSrc = cjs2es6export(src); // "export default function() {\n return 42;\n};;"

Currently only direct assignment to module.exports (translated to default export) is supported.

See also cjs2es6import

License

MIT

Dependents (1)

Package Sidebar

Install

npm i cjs2es6export

Weekly Downloads

1

Version

0.2.1

License

MIT

Last publish

Collaborators

  • deathcap