0.1.1 • Published 3 years ago

require-mjs-autoprefer-default-export-pmb v0.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

require-mjs-autoprefer-default-export-pmb

Automatically prefer the default export of a require()d .mjs file

API

This module exports one function:

autoPreferDefaultExport(imported)

If imported is an object with only one property, named default, returns imported.default, else returns imported.

Usage

const autoDefault = require('require-mjs-autoprefer-default-export-pmb');
const libCool = autoDefault(require('./lib/cool'));

Known issues

  • Needs more/better tests and docs.

 

License

ISC