Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(nuData.files.onend = function (newFiles) {
delete this.readers[rootPath];
if (newFiles.length) {
newFiles = newFiles.map(getPath);
remove.apply(result, newFiles);
if (promise.resolved || stream) {
promise.emit("change", {
data: result,
removed: newFiles,
added: []
});
}
}
}.bind(this))
);
.done(function () {
if (files) {
removed = data.removed.filter(contains, files);
if (removed.length || (nFiles && nFiles.length)) {
remove.apply(files, removed);
if (nFiles) push.apply(files, nFiles);
result.files.emit("change", {
data: files,
removed: removed,
added: nFiles || []
});
}
}
if (getDirs) {
removed = data.removed.filter(contains, dirs);
if (removed.length || (nDirs && nDirs.length)) {
remove.apply(dirs, removed);
if (nDirs) push.apply(dirs, nDirs);
result.dirs.emit("change", {
data: dirs,
removed: removed,
if (files) {
removed = data.removed.filter(contains, files);
if (removed.length || (nFiles && nFiles.length)) {
remove.apply(files, removed);
if (nFiles) push.apply(files, nFiles);
result.files.emit("change", {
data: files,
removed: removed,
added: nFiles || []
});
}
}
if (getDirs) {
removed = data.removed.filter(contains, dirs);
if (removed.length || (nDirs && nDirs.length)) {
remove.apply(dirs, removed);
if (nDirs) push.apply(dirs, nDirs);
result.dirs.emit("change", {
data: dirs,
removed: removed,
added: nDirs || []
});
}
}
});
});
nuData.files.on("change", function (nextData) {
var removed, added;
removed = rootPath ? nextData.removed.map(getPath) : nextData.removed;
added = rootPath ? nextData.added.map(getPath) : nextData.added;
remove.apply(result, removed);
push.apply(result, added);
if (promise.resolved || stream) {
promise.emit("change", { data: result, removed: removed, added: added });
}
});
}
original(path, function (err, data) {
var removed, added;
if (err) {
promise.emit("end", files, err);
return;
}
removed = diff.call(files, data);
added = diff.call(data, files);
if (removed.length || added.length) {
remove.apply(files, removed);
push.apply(files, added);
promise.emit("change", { data: files, removed: removed, added: added });
}
});
});
paths.on("change", function (data) {
var removed, added;
removed = data.removed.filter(contains, result);
added = data.added.filter(filter);
if (removed.length || added.length) {
remove.apply(result, removed);
push.apply(result, added);
promise.emit("change", { data: result, removed: removed, added: added });
}
});
paths.on("end", function (data, err) { promise.emit("end", result, err); });
onEnd = function () {
if (removed.length || added.length) {
remove.apply(result, removed);
push.apply(result, added);
promise.emit("change", { data: result, removed: removed, added: added });
}
};
if (!waiting) {