Skip to content

coderaiser/node-tryrequire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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?

const tryRequire = require('tryrequire');
const config = tryRequire('./config') || {}; 

License

MIT