Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

ral

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ral

Path aliasing for require.

Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
15
1400%
Maintainers
1
Weekly downloads
 
Created
Source

Require ALias Build Status

Require path aliasing.

This module allows you to easily move files and directories in your app without having to update many require calls. Instead you update the relevant alias definition.

The paths aliases to be used are defined in require-paths.json. This file is found by the ral module using, findup(process.env.REQUIRE_PATHS || '*/require-paths.json'). The default is the root of your project, or customize its path using process.env.REQUIRE_PATHS.

For example if require-paths.json is:

{
   "constants" : "lib/constants"
}

Then the module at lib/constants can be retrieved with:

require('ral')('constants')

If the location of constants changes, only require-paths.json needs to be updated.

A path can be added after the key. For example given constants above:

require('ral')('constants/something')

will give you lib/constants/something.

Source (~20 lines)

Release Notes:

  • 2014-06-02 0.0.1 Initial Release
  • 2014-06-03 0.1.0 Added tests & process.env.REQUIRE_PATHS
  • 2014-06-03 0.1.1 Locking down node version to >=0.8
  • 2014-06-04 0.1.2 Removing hard coded path separator

Keywords

paths

FAQs

Package last updated on 09 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts