mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-20 02:58:05 +00:00
simplify determine args method
This commit is contained in:
parent
cf13f098ac
commit
f08bb56337
@ -30,38 +30,30 @@ class Deploy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let realArgs = [];
|
async.map(args, (arg, nextEachCb) => {
|
||||||
async.eachLimit(args, 1, (arg, nextEachCb) => {
|
|
||||||
if (arg[0] === "$") {
|
if (arg[0] === "$") {
|
||||||
let contractName = arg.substr(1);
|
let contractName = arg.substr(1);
|
||||||
self.events.request('contracts:contract', contractName, (referedContract) => {
|
self.events.request('contracts:contract', contractName, (referedContract) => {
|
||||||
realArgs.push(referedContract.deployedAddress);
|
nextEachCb(null, referedContract.deployedAddress);
|
||||||
nextEachCb();
|
|
||||||
});
|
});
|
||||||
} else if (Array.isArray(arg)) {
|
} else if (Array.isArray(arg)) {
|
||||||
let subRealArgs = [];
|
async.map(arg, (sub_arg, nextSubEachCb) => {
|
||||||
|
|
||||||
async.eachLimit(arg, 1, (sub_arg, nextSubEachCb) => {
|
|
||||||
if (sub_arg[0] === "$") {
|
if (sub_arg[0] === "$") {
|
||||||
let contractName = sub_arg.substr(1);
|
let contractName = sub_arg.substr(1);
|
||||||
|
|
||||||
self.events.request('contracts:contract', contractName, (referedContract) => {
|
self.events.request('contracts:contract', contractName, (referedContract) => {
|
||||||
subRealArgs.push(referedContract.deployedAddress);
|
nextSubEachCb(null, referedContract.deployedAddress);
|
||||||
nextSubEachCb();
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
subRealArgs.push(sub_arg);
|
nextSubEachCb(null, sub_arg);
|
||||||
nextSubEachCb();
|
|
||||||
}
|
}
|
||||||
}, () => {
|
}, (err, subRealArgs) => {
|
||||||
realArgs.push(subRealArgs);
|
nextEachCb(null, subRealArgs);
|
||||||
nextEachCb();
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
realArgs.push(arg);
|
nextEachCb(null, arg);
|
||||||
nextEachCb();
|
|
||||||
}
|
}
|
||||||
}, () => {
|
}, (err, realArgs) => {
|
||||||
callback(realArgs);
|
callback(realArgs);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user