Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

requireg

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requireg - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

4

lib/requireg.js

@@ -31,5 +31,5 @@ var fs = require('fs')

function resolve(module) {
var resolver, modulePath
var i, resolver, modulePath
for (var i = 0, l = resolvers.length; i < l; i += 1) {
for (i = 0, l = resolvers.length; i < l; i += 1) {
resolver = resolvers[i]

@@ -36,0 +36,0 @@ if (modulePath = resolver(module)) {

@@ -13,2 +13,3 @@ var fs = require('fs')

userHomeResolve,
nodeModulesResolve,
globalResolve

@@ -36,3 +37,3 @@ ]

function nodePathResolve(module) {
var modulePath
var i, l, modulePath
var nodePath = process.env.NODE_PATH

@@ -51,3 +52,3 @@

for (var i = 0, l = nodePath.length; i < l; i += 1) {
for (i = 0, l = nodePath.length; i < l; i += 1) {
if (modulePath = resolveFn(module, nodePath[i])) {

@@ -62,3 +63,3 @@ break;

function userHomeResolve(module) {
var modulePath
var i, l, modulePath
var homePath = isWin32 ? process.env['USERPROFILE'] : process.env['HOME']

@@ -72,3 +73,3 @@

for (var i = 0, l = paths.length; i < l; i += 1) {
for (i = 0, l = paths.length; i < l; i += 1) {
if (modulePath = resolveFn(module, homePath, paths[i])) {

@@ -97,1 +98,17 @@ break;

}
function nodeModulesResolve(module) {
var i, l, modulePath
var nodeModules = process.env['NODE_MODULES']
if (nodeModules && typeof nodeModules === 'string') {
nodeModules = nodeModules.split(';')
for (i = 0, l = nodeModules.length; i < l; i += 1) {
if (modulePath = resolveFn(module, nodeModules[i])) {
break;
}
}
}
return modulePath
}
{
"name": "requireg",
"version": "0.1.1",
"version": "0.1.2",
"description": "Require global modules like a boss",

@@ -33,3 +33,4 @@ "homepage": "http://github.com/h2non/requireg",

"module",
"require"
"require",
"import"
],

@@ -36,0 +37,0 @@ "dependencies": {

@@ -1,2 +0,4 @@

# requireg [![Build Status](https://secure.travis-ci.org/h2non/node-requireg.png?branch=master)](http://travis-ci.org/h2non/node-requireg)
# requireg
[![Build Status](https://secure.travis-ci.org/h2non/requireg.png?branch=master)][2]
[![NPM version](https://badge.fury.io/js/requireg.png)][3]

@@ -16,2 +18,3 @@ > Require global modules in node.js like a boss

- $PREFIX/lib/node_modules (instead of $PREFIX/lib/node)
- $NODE_MODULES (use the specific modules path environment variable)

@@ -23,3 +26,4 @@ ## Resolution priority

3. Node installation path
4. Common operative system installation paths
4. $NODE_MODULES (can have different multiple paths, semicolon separated)
5. Common operative system installation paths

@@ -78,3 +82,9 @@ ## Installation

## License
Released under MIT license
[1]: http://nodejs.org/docs/latest/api/modules.html#modules_all_together
[2]: http://travis-ci.org/h2non/requireg
[3]: http://badge.fury.io/js/requireg

@@ -73,2 +73,18 @@ var expect = require('expect.js')

describe('resolve via $NODE_MODULES', function () {
before(function () {
process.env.NODE_MODULES = __dirname + '/fixtures/lib'
})
after(function () {
process.env.NODE_MODULES = ''
})
it('should resolve the beaker package', function () {
expect(requiregModule('beaker')).to.be.true
})
})
describe('resolve via node execution path', function () {

@@ -75,0 +91,0 @@ var execPath = process.execPath

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc