-
Notifications
You must be signed in to change notification settings - Fork 820
Open
Description
In network.js..
static create(options) {
if (typeof options === 'string')
options = networks[options];
assert(options, 'Unknown network.');
if (Network[options.type]) // <<< Line 136
return Network[options.type];
const network = new Network(options);
Network[network.type] = network;
if (!Network.primary)
Network.primary = network;
return network;
}
This method will take a string, or a set of key-value pairs it uses as options. Still, it is possible to send an empty object, or other not-specifically-handled type, and it would cause an exception on line 136. Should we create a type for these options, and use instanceof like, for example the get() method a little further down in network.js...
static get(type) {
if (!type) {
assert(Network.primary, 'No default network.');
return Network.primary;
}
if (type instanceof Network) // Like this here..
return type;
if (typeof type === 'string')
return Network.create(type);
throw new Error('Unknown network.');
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels