Pass options as { header: options } (create) (#16)

* Pass options as { header: options } (create)

* Actually save... pass linting as a result
This commit is contained in:
Jaco Greeff
2018-12-10 10:29:39 +01:00
committed by GitHub
parent 63495679c0
commit 58aacdaa33
+12 -10
View File
@@ -35,14 +35,14 @@ class KeyringOption implements KeyringOptionInstance {
this.addAccounts(keyring, options);
this.addAddresses(keyring, options);
options.address = this.linkItems(
{ header: 'Addresses', options: options.address },
{ header: 'Recent', options: options.recent }
);
options.account = this.linkItems(
{ header: 'Accounts', options: options.account },
{ header: 'Development', options: options.testing }
);
options.address = this.linkItems({
'Addresses': options.address,
'Recent': options.recent
});
options.account = this.linkItems({
'Accounts': options.account,
'Development': options.testing
});
options.all = ([] as KeyringSectionOptions).concat(
options.account,
@@ -55,8 +55,10 @@ class KeyringOption implements KeyringOptionInstance {
hasCalledInitOptions = true;
}
private linkItems (...items: Array<{ header: string, options: KeyringSectionOptions }>) {
return items.reduce((result, { header, options }) => {
private linkItems (items: { [index: string]: KeyringSectionOptions }) {
return Object.keys(items).reduce((result, header) => {
const options = items[header];
return result.concat(
options.length
? [this.createOptionHeader(header)]