diff options
Diffstat (limited to 'lib/utils/path.js')
-rw-r--r-- | lib/utils/path.js | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/utils/path.js b/lib/utils/path.js index a4968c8..9daa8e6 100644 --- a/lib/utils/path.js +++ b/lib/utils/path.js @@ -1,6 +1,4 @@ -var _ = require('lodash'); var path = require('path'); - var error = require('./error'); // Normalize a filename @@ -18,17 +16,15 @@ function isInRoot(root, filename) { // Throw error if file is outside this folder function resolveInRoot(root) { var input, result; + var args = Array.prototype.slice.call(arguments, 1); - input = _.chain(arguments) - .toArray() - .slice(1) + input = args .reduce(function(current, p) { // Handle path relative to book root ("/README.md") if (p[0] == '/' || p[0] == '\\') return p.slice(1); return current? path.join(current, p) : path.normalize(p); - }, '') - .value(); + }, ''); result = path.resolve(root, input); |