1.1.3 • Published 1 year ago

module-unifier v1.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

NPM Link

📦 Install

npm install module-unifier

🪄 Usage

Here are some examples of how to use module-unifier

Basic Usage

const { express, path, fs } = require('module-unifier');

// Now you can use express, path, and fs as if you've required them individually
const app = express();
const filePath = path.join(__dirname, 'example.txt');
const fileContents = fs.readFileSync(filePath, 'utf8');

Requiring Local Files

const { express, "./utils/myUtil.js": myUtil } = require('module-unifier');

// Now you can use express and myUtil
const app = express();
myUtil.doSomething();

Multiple Imports

const {
   express, mongoose, path, passport,
   "method-override": methodOverride,
   "./utils/ExpressError.js": ExpressError,
   "./routes/listing.js": listing,
   "cookie-parser": cookieParser,
   "express-session": session,
} = require("module-unifier");

// Use the imported modules
const app = express();
mongoose.connect(config.dbUri);

🚀 Features

  • Unified interface for requiring npm packages and local files
  • Reduces boilerplate code
  • Improves code readability
  • Provides helpful error messages for missing modules

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago