https://github.com/coderaiser/node-tryrequire
Try to require
https://github.com/coderaiser/node-tryrequire
Last synced: about 2 months ago
JSON representation
Try to require
- Host: GitHub
- URL: https://github.com/coderaiser/node-tryrequire
- Owner: coderaiser
- License: mit
- Created: 2014-10-29T17:47:09.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-06-24T12:25:59.000Z (almost 6 years ago)
- Last Synced: 2025-08-17T19:53:54.489Z (9 months ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
# Try Require
Try to require and if could not return `undefined`.
## Install
```
npm i tryrequire --save
```
## Options
- log : will log error when could not load
- callback : will return function wich will have error parameter.
## How to use?
```js
const tryRequire = require('tryrequire');
const config = tryRequire('./config') || {};
```
## License
MIT