New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fs-tools

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-tools - npm Package Compare versions

Comparing version

to
0.2.8

test/walk-sync-test.js

6

HISTORY.md

@@ -0,1 +1,7 @@

0.2.8 / 2013-01-08
------------------
* Added FsTools.walkSync()
0.2.7 / 2012-12-19

@@ -2,0 +8,0 @@ ------------------

@@ -263,3 +263,54 @@ /**

/**
* FsTools.walkSync(path, pattern, iterator) -> void
* FsTools.walkSync(path, iterator) -> void
*
* Synchronous version of [[FsTool.walk]].
**/
fstools.walkSync = function (path, pattern, iterator) {
var match, stat;
if (!iterator) {
pattern = null;
iterator = arguments[1];
}
if (!pattern) {
match = function () { return true; };
} else if (_.isFunction(pattern) && !_.isRegExp(pattern)) {
match = pattern;
} else {
pattern = new RegExp(pattern);
match = function (path) { return pattern.test(path); };
}
path = path_normalize(path);
try {
stat = fs.lstatSync(path);
} catch (err) {
if ('ENOENT' === err.code) {
return;
}
// rethrow
throw err;
}
if (stat.isDirectory()) {
fs.readdirSync(path).forEach(function (file) {
fstools.walkSync(path_join(path, file), match, iterator);
});
return;
}
if (match(path)) {
iterator(path, stat);
return;
}
};
/**
* FsTools.remove(path, callback) -> void

@@ -266,0 +317,0 @@ * - path (String): Path to remove

2

package.json
{
"name" : "fs-tools",
"version" : "0.2.7",
"version" : "0.2.8",
"description" : "fs helper utilities (walk, copy, mkdir -p)",

@@ -5,0 +5,0 @@ "keywords" : ["fs", "file", "utils"],

Sorry, the diff of this file is not supported yet