Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mkdir-p

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mkdir-p - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

46

index.js

@@ -5,44 +5,22 @@ var fs = require('fs');

var mkdir = function (dist, callback) {
var list = [];
dist = path.resolve(dist);
dist.split(/[\\\/]/)
.reduce(function (first, second) {
var _path = path.join(first, second);
list.push(_path);
return _path;
});
(function () {
var args = arguments,
_path = '';
if (list.length > 0) {
_path = list.shift();
fs.exists(_path, function (exists) {
if (exists) {
args.callee();
} else {
fs.mkdir(_path, function (err) {
if (err) {
callback && callback(err);
} else {
args.callee();
}
})
}
fs.exists(dist, function (exists) {
if (!exists) {
mkdir(path.dirname(dist), function () {
fs.mkdir(dist, function (err) {
callback && callback(err);
});
});
} else {
callback && callback(null, _path);
callback && callback(null);
}
})();
});
};
mkdir.sync = function (dist) {
dist = path.resolve(dist);
dist.split(/[\\\/]/)
.reduce(function (first, second) {
var _path = path.join(first || '/', second);
if (!fs.existsSync(_path)) {
fs.mkdirSync(_path);
}
return _path;
});
if (!fs.existsSync(dist)) {
mkdir.sync(path.dirname(dist));
fs.mkdirSync(dist);
}
};
module.exports = mkdir;

@@ -21,3 +21,3 @@ {

},
"version": "0.0.5",
"version": "0.0.6",
"readmeFilename": "README.md",

@@ -24,0 +24,0 @@ "bugs": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc