Comparing version
@@ -11,7 +11,11 @@ module.exports = chmodr | ||
// doesn't exist. give up. | ||
if (er && er.code !== "ENOTDIR") return cb(er) | ||
if (er || !children.length) return fs.chmod(p, mode, cb) | ||
if (er && er.code !== "ENOTDIR") | ||
return cb(er) | ||
var isDir = !er | ||
var m = isDir ? dirMode(mode) : mode | ||
if (er || !children.length) | ||
return fs.chmod(p, m, cb) | ||
var len = children.length | ||
, errState = null | ||
var errState = null | ||
children.forEach(function (child) { | ||
@@ -23,3 +27,3 @@ chmodr(path.resolve(p, child), mode, then) | ||
if (er) return cb(errState = er) | ||
if (-- len === 0) return fs.chmod(p, mode, cb) | ||
if (-- len === 0) return fs.chmod(p, dirMode(mode), cb) | ||
} | ||
@@ -37,3 +41,3 @@ }) | ||
} | ||
if (!children.length) return fs.chmodSync(p, mode) | ||
if (!children.length) return fs.chmodSync(p, dirMode(mode)) | ||
@@ -43,3 +47,12 @@ children.forEach(function (child) { | ||
}) | ||
return fs.chmodSync(p, mode) | ||
return fs.chmodSync(p, dirMode(mode)) | ||
} | ||
// If a party has r, add x | ||
// so that dirs are listable | ||
function dirMode(mode) { | ||
if (mode & 0400) mode |= 0100 | ||
if (mode & 040) mode |= 010 | ||
if (mode & 04) mode |= 01 | ||
return mode | ||
} |
@@ -5,3 +5,3 @@ { | ||
"description": "like `chmod -R`", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
5718
5.28%156
8.33%0
-100%1
Infinity%