Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

DRY version of the require() function used in Node.js

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json
Octocat-spinner-32 test.js
Octocat-spinner-32 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.