Skip to content

Commit 3133024

Browse files
committed
Fix: add return to callbacks
1 parent 590e080 commit 3133024

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/process/process.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const rcsProcess = (pathString, options, cb) => {
6969
let joinedPath;
7070
let shouldOverwrite = options.overwrite;
7171

72-
if (err) callback(err);
72+
if (err) return callback(err);
7373

7474
joinedPath = path.join(options.newPath, filePath);
7575

@@ -78,17 +78,17 @@ const rcsProcess = (pathString, options, cb) => {
7878
}
7979

8080
rcs.helper.save(joinedPath, data.data, { overwrite: shouldOverwrite }, (err) => {
81-
if (err) callback(err);
81+
if (err) return callback(err);
8282

8383
callback();
8484
});
8585
});
8686
}, err => {
8787
if (err) {
88-
cb(err);
89-
} else {
90-
cb(null, true);
88+
return cb(err);
9189
}
90+
91+
cb(null, true);
9292
});
9393
} else {
9494
// can be fired asynchronous
@@ -99,7 +99,7 @@ const rcsProcess = (pathString, options, cb) => {
9999
let joinedPath;
100100
let shouldOverwrite = options.overwrite;
101101

102-
if (err) callback(err);
102+
if (err) return callback(err);
103103

104104
joinedPath = path.join(options.newPath, filePath);
105105

@@ -108,17 +108,17 @@ const rcsProcess = (pathString, options, cb) => {
108108
}
109109

110110
rcs.helper.save(joinedPath, data.data, { overwrite: shouldOverwrite }, (err) => {
111-
if (err) callback(err);
111+
if (err) return callback(err);
112112

113113
callback();
114114
});
115115
});
116116
}, err => {
117117
if (err) {
118-
cb(err);
119-
} else {
120-
cb(null, true);
118+
return cb(err);
121119
}
120+
121+
cb(null, true);
122122
});
123123
}
124124
});

0 commit comments

Comments
 (0)