diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-29 20:07:23 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-29 20:07:23 +0900 |
commit | 68673957edad21700c58d252542a0aee04115d22 (patch) | |
tree | 7a58c00d82372a27b03fcbcdbf63d3fc7ec52c39 /src/shared | |
parent | aea17a52d692310ac459410c7d6b4e0bfd5e0225 (diff) | |
parent | 698f905145755954647f91ae01f5966b9e35a91e (diff) |
Merge pull request #596 from ueokande/qa-0.23
QA 0.23
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/Settings.ts | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/shared/Settings.ts b/src/shared/Settings.ts index e1e2046..0bef342 100644 --- a/src/shared/Settings.ts +++ b/src/shared/Settings.ts @@ -101,17 +101,23 @@ export const blacklistValueOf = (o: any): string[] => { export const valueOf = (o: any): Settings => { let settings = { ...DefaultSetting }; - if (Object.prototype.hasOwnProperty.call(o, 'keymaps')) { - settings.keymaps = keymapsValueOf(o.keymaps); - } - if (Object.prototype.hasOwnProperty.call(o, 'search')) { - settings.search = searchValueOf(o.search); - } - if (Object.prototype.hasOwnProperty.call(o, 'properties')) { - settings.properties = propertiesValueOf(o.properties); - } - if (Object.prototype.hasOwnProperty.call(o, 'blacklist')) { - settings.blacklist = blacklistValueOf(o.blacklist); + for (let key of Object.keys(o)) { + switch (key) { + case 'keymaps': + settings.keymaps = keymapsValueOf(o.keymaps); + break; + case 'search': + settings.search = searchValueOf(o.search); + break; + case 'properties': + settings.properties = propertiesValueOf(o.properties); + break; + case 'blacklist': + settings.blacklist = blacklistValueOf(o.blacklist); + break; + default: + throw new TypeError('unknown setting: ' + key); + } } return settings; }; |