Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Kill duplicate realpath call

  • Loading branch information...
commit 89cb4acc56f56996a5346d5c9502426958f15e46 1 parent 377ade3
@josh josh authored
Showing with 13 additions and 22 deletions.
  1. +8 −13 lib/stitch.js
  2. +5 −9 src/stitch.coffee
View
21 lib/stitch.js
@@ -115,23 +115,18 @@
Package.prototype.getRelativePath = function(path, callback) {
path = normalize(path);
return async.map(this.paths, fs.realpath, function(err, expandedPaths) {
+ var base, expandedPath, _i, _len;
if (err) {
return callback(err);
}
- return fs.realpath(path, function(err, path) {
- var base, expandedPath, _i, _len;
- if (err) {
- return callback(err);
- }
- for (_i = 0, _len = expandedPaths.length; _i < _len; _i++) {
- expandedPath = expandedPaths[_i];
- base = expandedPath + "/";
- if (path.indexOf(base) === 0) {
- return callback(null, path.slice(base.length));
- }
+ for (_i = 0, _len = expandedPaths.length; _i < _len; _i++) {
+ expandedPath = expandedPaths[_i];
+ base = expandedPath + "/";
+ if (path.indexOf(base) === 0) {
+ return callback(null, path.slice(base.length));
}
- return callback("" + path + " isn't in the require path");
- });
+ }
+ return callback("" + path + " isn't in the require path");
});
};
Package.prototype.compileFile = function(path, callback) {
View
14 src/stitch.coffee
@@ -111,15 +111,11 @@ exports.Package = class Package
async.map @paths, fs.realpath, (err, expandedPaths) ->
return callback err if err
- fs.realpath path, (err, path) ->
- return callback err if err
-
- for expandedPath in expandedPaths
- base = expandedPath + "/"
- if path.indexOf(base) is 0
- return callback null, path.slice base.length
-
- callback "#{path} isn't in the require path"
+ for expandedPath in expandedPaths
+ base = expandedPath + "/"
+ if path.indexOf(base) is 0
+ return callback null, path.slice base.length
+ callback "#{path} isn't in the require path"
compileFile: (path, callback) ->
extension = extname(path).slice(1)
Please sign in to comment.
Something went wrong with that request. Please try again.