change-default

1.1.2 • Public • Published

Change Default

Description

Convert exports.default to module.exports for all .js files in specified directories recursively

You can specify directory by --dir option

Note: it will not change if more exports are occurred

Installation

    npm install -g change-default

Github Repository Source Code

Usage

$: change-default --dir=build

--dir is optional

default dir is current directory

Examples

Before

function add(x, y) {
  return x + y;
}
exports.default = add;

After

function add(x, y) {
  return x + y;
}
module.exports = add;

Will not work when:

function add(x, y) {
  return x + y;
}
exports.owner = "Manick";
exports.default = add;

if there is more exports it will not change anything

License

The MIT License (MIT) - 2019

/change-default/

    Package Sidebar

    Install

    npm i change-default

    Weekly Downloads

    1

    Version

    1.1.2

    License

    ISC

    Unpacked Size

    5.06 kB

    Total Files

    7

    Last publish

    Collaborators

    • creanick