Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
prompt.get({ properties: promptProperties }, function(err: any, promptResult: any) {
if (err && err.message !== 'canceled') {
console.error('User prompted to select address - an error occured: %s', err, {});
q.reject(err);
}
var selection = promptResult.selection;
for (x = 0; x < addresses.length; x += 1) {
if (selection == x + 1 || selection == addresses[x].address || selection == addresses[x].dev) {
options.address = addresses[x].address;
if (!options.isAddressCmd) {
console.log(chalk.green.bold('Selected address: ') + options.address);
}
cdvliveConfig.set(addressConfigKey, options.address);
prompt.resume();
q.resolve(options.address);
return q.promise;
}
}
console.error('Invalid address selection');
});
}
if (err && err.message === 'canceled') {
log.info('Canceled by user');
process.exit(1);
}
var selection = promptResult.selection;
for (var x = 0; x < addresses.length; x += 1) {
if (parseInt(selection) === (x + 1) || selection === addresses[x].address || selection === addresses[x].dev) {
options.address = addresses[x].address;
if (!options.isAddressCmd) {
log.info('Selected address: ' + options.address);
}
ionicConfig.set(addressConfigKey, options.address);
prompt.resume();
q.resolve();
return q.promise;
}
}
Utils.fail('Invalid address selection');
});
prompt.get({ properties: promptProperties }, function (err, promptResult) {
if (err && err.message !== 'canceled') {
console.error('User prompted to select address - an error occured: %s', err, {});
q.reject(err);
}
var selection = promptResult.selection;
for (x = 0; x < addresses.length; x += 1) {
if (selection == x + 1 || selection == addresses[x].address || selection == addresses[x].dev) {
options.address = addresses[x].address;
if (!options.isAddressCmd) {
console.log(chalk.green.bold('Selected address: ') + options.address);
}
cdvliveConfig.set(addressConfigKey, options.address);
prompt.resume();
q.resolve(options.address);
return q.promise;
}
}
console.error('Invalid address selection');
});
}