Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] always normalize paths to posix (not windows \) #4

Merged
merged 1 commit into from
Mar 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
var throwOnRootAccess = true;
var ensurePosix = require('ensure-posix-path');

function resolveModules(options) {
options = options || {};

if (options.throwOnRootAccess === false) {
throwOnRootAccess = false;
}

return moduleResolve;
}

function moduleResolve(child, name) {
function moduleResolve(_child, _name) {
var child = ensurePosix(_child);
var name = ensurePosix(_name);
if (child.charAt(0) !== '.') { return child; }

var parts = child.split('/');
Expand All @@ -30,7 +33,6 @@ function moduleResolve(child, name) {
}
parentBase.pop();
} else if (part === '.') {

continue;
} else { parentBase.push(part); }
}
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"devDependencies": {
"chai": "^3.0.0",
"mocha": "^2.2.5"
},
"dependencies": {
"ensure-posix-path": "^1.0.1"
}
}