safeGetEntries typing improved

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 8 years ago
parent fa07bbd635
commit 80a7b9f420
  1. 16
      BuildServer/lib/git/copy.ts

@ -6,11 +6,11 @@ import { writeFile, mkdir } from "fs";
import { parallel } from "async"; import { parallel } from "async";
import { Copier } from "recursive-tree-copy"; import { Copier } from "recursive-tree-copy";
const safeGetEntries = (tree):any => { const safeGetEntries = (tree, callback) => {
try { try {
return { "entries": tree.gitTree.entries() }; return callback(null, tree.gitTree.entries());
} catch (err) { } catch (err) {
return { err }; return callback(err);
} }
}; };
@ -43,11 +43,9 @@ const gitToFsCopier = new Copier({
"walkSourceTree": (tree) => { "walkSourceTree": (tree) => {
const emitter = new EventEmitter(); const emitter = new EventEmitter();
process.nextTick(() => { process.nextTick(() => safeGetEntries(tree, (getEntriesErr, entries) => {
const { entries, err } = safeGetEntries(tree); if (getEntriesErr) {
return emitter.emit("error", getEntriesErr);
if (err) {
return emitter.emit("error", err);
} }
return parallel(entries.map((entry) => (callback) => { return parallel(entries.map((entry) => (callback) => {
@ -80,7 +78,7 @@ const gitToFsCopier = new Copier({
return emitter.emit("done"); return emitter.emit("done");
}); });
}); }));
return emitter; return emitter;
} }

Loading…
Cancel
Save