Socket
Socket
Sign inDemoInstall

fsmonitor

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

fsmonitor - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

lib/pathutil.js

86

lib/tree.js
// Generated by IcedCoffeeScript 1.3.3f
(function() {
var EventEmitter, FSChange, FSFile, FSTree, Path, debug, fs, iced, __iced_k, __iced_k_noop,
var EventEmitter, FSChange, FSFile, FSTree, Path, PlaPath, debug, fs, iced, __iced_k, __iced_k_noop,
__slice = [].slice,

@@ -53,2 +53,4 @@ __hasProp = {}.hasOwnProperty,

PlaPath = require('./pathutil').PlaPath;
FSFile = (function() {

@@ -131,3 +133,3 @@

_this._walk(_this.root, '', __iced_deferrals.defer({
lineno: 57
lineno: 59
}));

@@ -178,3 +180,3 @@ __iced_deferrals._fulfill();

_this._walk(_this.root, '', __iced_deferrals.defer({
lineno: 88
lineno: 90
}));

@@ -252,16 +254,2 @@ __iced_deferrals._fulfill();

FSTree.prototype.findMatchingPaths = function(list) {
var file;
return ((function() {
var _i, _len, _ref, _results;
_ref = this._files;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
if (list.matches(file.relpath)) _results.push(file.relpath);
}
return _results;
}).call(this)).sort();
};
Object.defineProperty(FSTree.prototype, 'allFiles', {

@@ -299,2 +287,60 @@ get: function() {

FSTree.prototype.findMatchingPaths = function(list) {
var file;
return ((function() {
var _i, _len, _ref, _results;
_ref = this._files;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
if (list.matches(file.relpath)) _results.push(file.relpath);
}
return _results;
}).call(this)).sort();
};
FSTree.prototype.findFilesBySuffix = function(suffix, _arg, callback) {
var allMatches, bestMatch, bestMatches, bestScore, bestSubtree, file, match, name, path, score;
bestSubtree = _arg.bestSubtree;
suffix = PlaPath.normalize(suffix);
name = Path.basename(suffix);
bestScore = 0;
allMatches = (function() {
var _i, _len, _ref, _results;
_ref = this._files;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
path = file.relpath;
if (Path.basename(path) !== name) continue;
score = PlaPath.numberOfMatchingTrailingComponents(path, suffix);
if (bestSubtree && PlaPath.isSubpath(path, bestSubtree)) score += 0.5;
if (score > bestScore) bestScore = score;
debug("findFilesMatchingSuffixInSubtree match: path = %j, score = %j", path, score);
_results.push({
path: path,
score: score
});
}
return _results;
}).call(this);
bestMatches = (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = allMatches.length; _i < _len; _i++) {
match = allMatches[_i];
if (match.score === bestScore) _results.push(match);
}
return _results;
})();
bestMatch = bestMatches.length === 1 ? bestMatches[0] : null;
return process.nextTick(function() {
return callback(null, {
allMatches: allMatches,
bestMatches: bestMatches,
bestMatch: bestMatch
});
});
};
FSTree.prototype._addError = function(path, err) {

@@ -333,3 +379,3 @@ return this._errors.push({

})(),
lineno: 157
lineno: 188
}));

@@ -362,3 +408,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 165
lineno: 196
}));

@@ -402,3 +448,3 @@ __iced_deferrals._fulfill();

_this._walk(Path.join(path, file), Path.join(relpath, file), __iced_deferrals.defer({
lineno: 169
lineno: 200
}));

@@ -405,0 +451,0 @@ __iced_deferrals._fulfill();

{
"name": "fsmonitor",
"version": "0.1.1",
"version": "0.1.2",
"description": "Fine-grained cross-platform file system monitoring for Node.js",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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