Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
DRY version of the require() function used in Node.js
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
LICENSE
README.md
index.js
package.json
test.js
use.js

README.md

Use.js

DRY version of require() for Node.js

Installation

npm install use

Example

eval(require('use')(
  'util', 
  'http',
  'https',
  'url',
  'path',
  'stream',

  'xregexp#XRegExp',

  './helper'
));

util.debug('Easy as pie...');

XRegExp.replace(
  'x-key-lime', 
  XRegExp('\\b\\w', 'g'), 
  function(match) { 
    return match.toUpperCase();
  }
);

helper.doSomethingGrand();

Warning

This module does not work in strict mode. Only enable strict mode, if you need it, after the eval statement.

Something went wrong with that request. Please try again.