module-alias
Advanced tools
Comparing version 1.0.10 to 2.0.0
13
index.js
@@ -25,3 +25,3 @@ 'use strict' | ||
for (var alias in moduleAliases) { | ||
if (request.indexOf(alias) === 0) { | ||
if (isPathMatchesAlias(request, alias)) { | ||
request = nodePath.join( | ||
@@ -37,2 +37,12 @@ moduleAliases[alias], | ||
function isPathMatchesAlias (path, alias) { | ||
// Matching /^alias(\/|$)/ | ||
if (path.indexOf(alias) === 0) { | ||
if (path.length === alias.length) return true | ||
if (path[alias.length] === '/') return true | ||
} | ||
return false | ||
} | ||
function addPathHelper (path, targetArray) { | ||
@@ -162,2 +172,3 @@ path = nodePath.normalize(path) | ||
module.exports.addAliases = addAliases | ||
module.exports.isPathMatchesAlias = isPathMatchesAlias | ||
module.exports.reset = reset |
{ | ||
"name": "module-alias", | ||
"description": "Create aliases of directories and register custom module paths in NodeJS like a boss!", | ||
"version": "1.0.10", | ||
"version": "2.0.0", | ||
"author": { | ||
"name": "Nikita Gavrilov", | ||
"name": "Nick Gavrilov", | ||
"email": "artnikpro@gmail.com" | ||
@@ -8,0 +8,0 @@ }, |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
9526
4
141
0
146