convert from ? notation to more concise || notation

This commit is contained in:
Ryan X. Charles 2014-04-15 15:12:37 -03:00
commit 34f30e88ea

18
API.js
View file

@ -7,26 +7,26 @@ var API = function(opts) {
API.prototype._init = function(opts) { API.prototype._init = function(opts) {
var self = this; var self = this;
opts = opts ? opts : {}; opts = opts || {};
self.opts = opts; self.opts = opts;
var Wallet = require('soop').load('./js/models/core/Wallet', { var Wallet = require('soop').load('./js/models/core/Wallet', {
Storage: opts.Storage ? opts.Storage : require('./test/FakeStorage'), Storage: opts.Storage || require('./test/FakeStorage'),
Network: opts.Network ? opts.Network : require('./js/models/Network/WebRTC'), Network: opts.Network || require('./js/models/Network/WebRTC'),
Blockchain: opts.Blockchain ? opts.Blockchain : require('./js/models/Blockchain/Insight') Blockchain: opts.Blockchain || require('./js/models/Blockchain/Insight')
}); });
var config = { var config = {
wallet: { wallet: {
requiredCopayers: opts.requiredCopayers ? opts.requiredCopayers : 3, requiredCopayers: opts.requiredCopayers || 3,
totalCopayers: opts.totalCopayers ? opts.totalCopayers : 5, totalCopayers: opts.totalCopayers || 5,
} }
}; };
var walletConfig = opts.walletConfig ? opts.walletConfig : config; var walletConfig = opts.walletConfig || config;
var walletOpts = opts.walletOpts ? opts.walletOpts : {}; var walletOpts = opts.walletOpts || {};
self.wallet = self.opts.wallet ? self.opts.wallet : Wallet.factory.create(walletConfig, walletOpts); self.wallet = self.opts.wallet || Wallet.factory.create(walletConfig, walletOpts);
}; };
API._coerceArgTypes = function(args, argTypes) { API._coerceArgTypes = function(args, argTypes) {