mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-08-03 05:02:54 +00:00
refactor(files) read: errors -> error
This commit is contained in:
parent
b387b65cdb
commit
320affbb38
3 changed files with 17 additions and 18 deletions
|
|
@ -6,26 +6,26 @@
|
|||
Util = require('../util');
|
||||
|
||||
object.read = function(files, options, callback) {
|
||||
var errors,
|
||||
done = [],
|
||||
var done = [],
|
||||
isDone = false,
|
||||
noOptions = Util.isFunction(options),
|
||||
readFiles = {},
|
||||
doneFunc = function (name, error, data) {
|
||||
done.pop();
|
||||
|
||||
if (!error)
|
||||
if (error)
|
||||
done = [];
|
||||
else
|
||||
readFiles[name] = data;
|
||||
else {
|
||||
if (!errors)
|
||||
errors = {};
|
||||
|
||||
errors[name] = error;
|
||||
}
|
||||
|
||||
if (!done.length)
|
||||
Util.exec(callback, errors, readFiles);
|
||||
if (!done.length && !isDone) {
|
||||
isDone = true;
|
||||
callback(error, readFiles);
|
||||
}
|
||||
};
|
||||
|
||||
Util.checkArgs(arguments, ['files', 'options', 'callback']);
|
||||
|
||||
if (noOptions) {
|
||||
callback = options;
|
||||
options = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue