Skip to content

convert CommonJS module assignments to ES6 module export statements

License

Notifications You must be signed in to change notification settings

deathcap/cjs2es6export

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

convert CommonJS module assignments to ES6 module export statements

Resources

License

Stars

Watchers

Forks

Packages

No packages published