diff --git a/src/const/NonPrintableKeysDictionary.js b/src/const/NonPrintableKeysDictionary.js index 7f231554..46d81dcc 100644 --- a/src/const/NonPrintableKeysDictionary.js +++ b/src/const/NonPrintableKeysDictionary.js @@ -3,8 +3,9 @@ */ import dictionaryFrom from '../utils/object/dictionaryFrom'; import translateToKey from '../vendor/react-dom/translateToKey'; +import objectValues from '../utils/object/values'; const NonPrintableKeysDictionary = - dictionaryFrom(Object.values(translateToKey)); + dictionaryFrom(objectValues(translateToKey)); export default NonPrintableKeysDictionary; diff --git a/src/lib/config/Configuration.js b/src/lib/config/Configuration.js index 25d925b8..f65b52cd 100644 --- a/src/lib/config/Configuration.js +++ b/src/lib/config/Configuration.js @@ -1,4 +1,5 @@ import dictionaryFrom from '../../utils/object/dictionaryFrom'; +import objectValues from '../../utils/object/values'; /** * Default configuration values @@ -150,7 +151,7 @@ class Configuration { } if (customKeyCodes) { - configuration._customKeyNamesDict = dictionaryFrom(Object.values(configuration.customKeyCodes)); + configuration._customKeyNamesDict = dictionaryFrom(objectValues(configuration.customKeyCodes)); } // noinspection JSUnresolvedVariable diff --git a/src/lib/listening/GlobalEventListenerAdaptor.js b/src/lib/listening/GlobalEventListenerAdaptor.js index ba9a79a5..7194e66f 100644 --- a/src/lib/listening/GlobalEventListenerAdaptor.js +++ b/src/lib/listening/GlobalEventListenerAdaptor.js @@ -1,6 +1,8 @@ import KeyEventType from '../../const/KeyEventType'; import describeKeyEventType from '../../helpers/logging/describeKeyEventType'; import normalizeEventName from '../../utils/string/normalizeEventName'; +import objectValues from '../../utils/object/values'; + class GlobalEventListenerAdaptor { constructor(strategy, {logger}) { @@ -20,7 +22,7 @@ class GlobalEventListenerAdaptor { } unbindListeners() { - Object.values(KeyEventType).forEach((recordIndex) => { + objectValues(KeyEventType).forEach((recordIndex) => { const eventName = describeKeyEventType(recordIndex); delete document[`on${eventName}`]; @@ -32,7 +34,7 @@ class GlobalEventListenerAdaptor { } bindListeners() { - Object.values(KeyEventType).forEach((recordIndex) => { + objectValues(KeyEventType).forEach((recordIndex) => { const eventName = describeKeyEventType(recordIndex); document[`on${eventName}`] = (keyEvent) => { diff --git a/src/lib/matching/KeyCombinationMatcher.js b/src/lib/matching/KeyCombinationMatcher.js index e8c997af..ad693a0f 100644 --- a/src/lib/matching/KeyCombinationMatcher.js +++ b/src/lib/matching/KeyCombinationMatcher.js @@ -2,6 +2,7 @@ import Configuration from '../config/Configuration'; import size from '../../utils/collection/size'; import keyupIsHiddenByCmd from '../../helpers/resolving-handlers/keyupIsHiddenByCmd'; import lazyLoadAttribute from '../../utils/object/lazyLoadAttribute'; +import objectValues from '../../utils/object/values'; import KeyCombinationIterator from '../listening/KeyCombinationIterator'; /** @@ -149,7 +150,7 @@ class KeyCombinationMatcher { * size so that they may be applied in the correct priority order */ - const combinationsPartitionedBySize = Object.values(this._actionConfigs).reduce((memo, {id, size}) => { + const combinationsPartitionedBySize = objectValues(this._actionConfigs).reduce((memo, {id, size}) => { if (!memo[size]) { memo[size] = []; } diff --git a/src/utils/object/values.js b/src/utils/object/values.js new file mode 100644 index 00000000..8f360ca6 --- /dev/null +++ b/src/utils/object/values.js @@ -0,0 +1 @@ +export default object => Object.keys(object).map(key => object[key]);