mkdir-promise
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -35,2 +35,5 @@ "use strict"; | ||
var paths = dir.split(path.sep); | ||
if (paths[0] === '') { | ||
paths[0] = path.sep; | ||
} | ||
return paths.reduce(function (promise, fp) { | ||
@@ -46,3 +49,3 @@ return promise.then(function (prev) { | ||
} else { | ||
var err = new Error("Conot create directory " + fp + ": Not a directory."); | ||
var err = new Error("Cannot create directory " + fp + ": Not a directory."); | ||
return Promise.reject(err); | ||
@@ -49,0 +52,0 @@ } |
{ | ||
"name": "mkdir-promise", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "fs.mkdir implementation with es6 Promise", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
var assert = require("assert"); | ||
var mkdir = require("../index"); | ||
var child_process = require("child_process"); | ||
var path = require('path'); | ||
@@ -20,2 +21,11 @@ describe("mkdir -p foo/bar", function () { | ||
}); | ||
it("should handle absolute paths", function (done) { | ||
var absolutePath = path.join(__dirname, "foo", "bar"); | ||
mkdir(absolutePath).then(function (rst) { | ||
assert.equal(rst, absolutePath); | ||
done(); | ||
}).catch(function (ex) { | ||
done(ex); | ||
}); | ||
}); | ||
after(function () { | ||
@@ -22,0 +32,0 @@ child_process.exec("rm -r foo"); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3444
82