stdlib-js

stdlib-js/utils-try-require

Wrap `require` in a try/catch block.

JavaScript
3
0
Apache License 2.0

This package provides a utility function that wraps Node.js's `require` statement in a try/catch block, returning either the required module or an Error object if the module cannot be resolved. It's designed for JavaScript developers who need a safe way to dynamically load modules without risking uncaught exceptions when a module is missing or invalid. The function is particularly useful in scenarios where module loading might fail, such as plugin systems or optional dependencies.

Total donated
Undistributed
Share with your subscribers:

Recipients

How the donated funds are distributed

Support the dependencies of stdlib-js/utils-try-require

Account's avatar
Test if a value is an Error object.
Account's avatar
Test if a value is a function.
Account's avatar
tap-producing test harness for node and browsers
Account's avatar
Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale
Account's avatar
Minimal TAP output formatter.
Account's avatar
Benchmark harness.

Support the repos that depend on stdlib-js/utils-try-require

Top contributors

stdlib-bot's profile
stdlib-bot
68 contributions

Recent events

Kivach works on the Obyte network, and therefore you can track all donations.

No events yet