Socket
Socket
Sign inDemoInstall

ember-require-module

Package Overview
Dependencies
291
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ember-require-module

Easily require a module which will silently fail if it is not found.


Version published
Maintainers
2
Install size
28.7 MB
Created

Changelog

Source

v0.4.0 (2022-06-27)

:rocket: Enhancement
  • #9 Update ember cli to 4.4 (@fsmanuel)
Committers: 1

Readme

Source

ember-require-module

Build Status Ember Observer Score npm version

Dynamically require modules

Installation

ember install ember-require-module

Looking for help?

If it is a bug please open an issue on GitHub.

Usage

import requireModule from 'ember-require-module';

const moment = requireModule('moment');

// requireModule will return undefined if moment is not found
assert('MomentJS is required!', moment);


// Dynamically require modules when needed
function runTask(taskName, ...params) {
  let task = requireModule(`my-addon/tasks/${taskName}`);

  assert(`The task ${taskName} does not exist.`, task);

  return task.run(...params);
}

// import a named export from a module
const THING = requireModule('path-to-module', 'THING');

Compatibility

See the Changelog

  • Ember.js v3.24 or above
  • Ember CLI v3.24 or above
  • Node.js v12 or above

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Keywords

FAQs

Last updated on 27 Jun 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc