summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-25 14:19:18 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-26 22:06:27 -0500
commit0aed27b66d9c496e4cd57ef95d982c4e634a8666 (patch)
treee73353f53b028c211fe38043bd12a3a520daa9c1 /ext
parent663667306ce7ddcfeb603191dcd4a0f133f08b37 (diff)
Replace hasOwnProperty with simplified hasOwn function
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/api.js4
-rw-r--r--ext/bg/js/audio.js6
-rw-r--r--ext/bg/js/backend.js2
-rw-r--r--ext/bg/js/conditions-ui.js20
-rw-r--r--ext/bg/js/conditions.js30
-rw-r--r--ext/bg/js/database.js2
-rw-r--r--ext/bg/js/dictionary.js4
-rw-r--r--ext/bg/js/mecab.js2
-rw-r--r--ext/bg/js/options.js2
-rw-r--r--ext/bg/js/search.js2
-rw-r--r--ext/bg/js/settings-dictionaries.js4
-rw-r--r--ext/bg/js/settings-popup-preview.js2
-rw-r--r--ext/bg/js/translator.js12
-rw-r--r--ext/fg/js/float.js4
-rw-r--r--ext/fg/js/frontend-api-receiver.js2
-rw-r--r--ext/fg/js/frontend-api-sender.js6
-rw-r--r--ext/fg/js/frontend.js4
-rw-r--r--ext/fg/js/popup-proxy-host.js4
-rw-r--r--ext/mixed/js/audio.js2
-rw-r--r--ext/mixed/js/core.js4
-rw-r--r--ext/mixed/js/display.js4
21 files changed, 63 insertions, 59 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index 766fb0ed..12257e92 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -45,7 +45,7 @@ async function apiOptionsSet(changedOptions, optionsContext, source) {
function modifyOption(path, value, options) {
let pivot = options;
for (const key of path.slice(0, -1)) {
- if (!pivot.hasOwnProperty(key)) {
+ if (!hasOwn(pivot, key)) {
return false;
}
pivot = pivot[key];
@@ -236,7 +236,7 @@ async function apiTemplateRender(template, data, dynamic) {
async function apiCommandExec(command, params) {
const handlers = apiCommandExec.handlers;
- if (handlers.hasOwnProperty(command)) {
+ if (hasOwn(handlers, command)) {
const handler = handlers[command];
handler(params);
}
diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js
index cd42a158..9bbbf902 100644
--- a/ext/bg/js/audio.js
+++ b/ext/bg/js/audio.js
@@ -107,12 +107,12 @@ const audioUrlBuilders = {
'custom': async (definition, optionsContext) => {
const options = await apiOptionsGet(optionsContext);
const customSourceUrl = options.audio.customSourceUrl;
- return customSourceUrl.replace(/\{([^\}]*)\}/g, (m0, m1) => (definition.hasOwnProperty(m1) ? `${definition[m1]}` : m0));
+ return customSourceUrl.replace(/\{([^\}]*)\}/g, (m0, m1) => (hasOwn(definition, m1) ? `${definition[m1]}` : m0));
}
};
async function audioGetUrl(definition, mode, optionsContext, download) {
- if (audioUrlBuilders.hasOwnProperty(mode)) {
+ if (hasOwn(audioUrlBuilders, mode)) {
const handler = audioUrlBuilders[mode];
try {
return await handler(definition, optionsContext, download);
@@ -171,7 +171,7 @@ async function audioInject(definition, fields, sources, optionsContext) {
try {
let audioSourceDefinition = definition;
- if (definition.hasOwnProperty('expressions')) {
+ if (hasOwn(definition, 'expressions')) {
audioSourceDefinition = definition.expressions[0];
}
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 45db9660..4190116b 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -73,7 +73,7 @@ class Backend {
onMessage({action, params}, sender, callback) {
const handlers = Backend.messageHandlers;
- if (handlers.hasOwnProperty(action)) {
+ if (hasOwn(handlers, action)) {
const handler = handlers[action];
const promise = handler(params, sender);
promise.then(
diff --git a/ext/bg/js/conditions-ui.js b/ext/bg/js/conditions-ui.js
index 43c6dc08..cc9db087 100644
--- a/ext/bg/js/conditions-ui.js
+++ b/ext/bg/js/conditions-ui.js
@@ -84,7 +84,7 @@ ConditionsUI.Container = class Container {
createDefaultCondition(type) {
let operator = '';
let value = '';
- if (this.conditionDescriptors.hasOwnProperty(type)) {
+ if (hasOwn(this.conditionDescriptors, type)) {
const conditionDescriptor = this.conditionDescriptors[type];
operator = conditionDescriptor.defaultOperator;
({value} = this.getOperatorDefaultValue(type, operator));
@@ -96,15 +96,15 @@ ConditionsUI.Container = class Container {
}
getOperatorDefaultValue(type, operator) {
- if (this.conditionDescriptors.hasOwnProperty(type)) {
+ if (hasOwn(this.conditionDescriptors, type)) {
const conditionDescriptor = this.conditionDescriptors[type];
- if (conditionDescriptor.operators.hasOwnProperty(operator)) {
+ if (hasOwn(conditionDescriptor.operators, operator)) {
const operatorDescriptor = conditionDescriptor.operators[operator];
- if (operatorDescriptor.hasOwnProperty('defaultValue')) {
+ if (hasOwn(operatorDescriptor, 'defaultValue')) {
return {value: operatorDescriptor.defaultValue, fromOperator: true};
}
}
- if (conditionDescriptor.hasOwnProperty('defaultValue')) {
+ if (hasOwn(conditionDescriptor, 'defaultValue')) {
return {value: conditionDescriptor.defaultValue, fromOperator: false};
}
}
@@ -219,7 +219,7 @@ ConditionsUI.Condition = class Condition {
optionGroup.empty();
const type = this.condition.type;
- if (conditionDescriptors.hasOwnProperty(type)) {
+ if (hasOwn(conditionDescriptors, type)) {
const conditionDescriptor = conditionDescriptors[type];
const operators = conditionDescriptor.operators;
for (const operatorName of Object.keys(operators)) {
@@ -240,23 +240,23 @@ ConditionsUI.Condition = class Condition {
};
const objects = [];
- if (conditionDescriptors.hasOwnProperty(type)) {
+ if (hasOwn(conditionDescriptors, type)) {
const conditionDescriptor = conditionDescriptors[type];
objects.push(conditionDescriptor);
- if (conditionDescriptor.operators.hasOwnProperty(operator)) {
+ if (hasOwn(conditionDescriptor.operators, operator)) {
const operatorDescriptor = conditionDescriptor.operators[operator];
objects.push(operatorDescriptor);
}
}
for (const object of objects) {
- if (object.hasOwnProperty('placeholder')) {
+ if (hasOwn(object, 'placeholder')) {
props.placeholder = object.placeholder;
}
if (object.type === 'number') {
props.type = 'number';
for (const prop of ['step', 'min', 'max']) {
- if (object.hasOwnProperty(prop)) {
+ if (hasOwn(object, prop)) {
props[prop] = object[prop];
}
}
diff --git a/ext/bg/js/conditions.js b/ext/bg/js/conditions.js
index ed4b14f5..c0f0f301 100644
--- a/ext/bg/js/conditions.js
+++ b/ext/bg/js/conditions.js
@@ -18,14 +18,14 @@
function conditionsValidateOptionValue(object, value) {
- if (object.hasOwnProperty('validate') && !object.validate(value)) {
+ if (hasOwn(object, 'validate') && !object.validate(value)) {
throw new Error('Invalid value for condition');
}
- if (object.hasOwnProperty('transform')) {
+ if (hasOwn(object, 'transform')) {
value = object.transform(value);
- if (object.hasOwnProperty('validateTransformed') && !object.validateTransformed(value)) {
+ if (hasOwn(object, 'validateTransformed') && !object.validateTransformed(value)) {
throw new Error('Invalid value for condition');
}
}
@@ -34,12 +34,12 @@ function conditionsValidateOptionValue(object, value) {
}
function conditionsNormalizeOptionValue(descriptors, type, operator, optionValue) {
- if (!descriptors.hasOwnProperty(type)) {
+ if (!hasOwn(descriptors, type)) {
throw new Error('Invalid type');
}
const conditionDescriptor = descriptors[type];
- if (!conditionDescriptor.operators.hasOwnProperty(operator)) {
+ if (!hasOwn(conditionDescriptor.operators, operator)) {
throw new Error('Invalid operator');
}
@@ -48,28 +48,28 @@ function conditionsNormalizeOptionValue(descriptors, type, operator, optionValue
let transformedValue = conditionsValidateOptionValue(conditionDescriptor, optionValue);
transformedValue = conditionsValidateOptionValue(operatorDescriptor, transformedValue);
- if (operatorDescriptor.hasOwnProperty('transformReverse')) {
+ if (hasOwn(operatorDescriptor, 'transformReverse')) {
transformedValue = operatorDescriptor.transformReverse(transformedValue);
}
return transformedValue;
}
function conditionsTestValueThrowing(descriptors, type, operator, optionValue, value) {
- if (!descriptors.hasOwnProperty(type)) {
+ if (!hasOwn(descriptors, type)) {
throw new Error('Invalid type');
}
const conditionDescriptor = descriptors[type];
- if (!conditionDescriptor.operators.hasOwnProperty(operator)) {
+ if (!hasOwn(conditionDescriptor.operators, operator)) {
throw new Error('Invalid operator');
}
const operatorDescriptor = conditionDescriptor.operators[operator];
- if (operatorDescriptor.hasOwnProperty('transform')) {
- if (operatorDescriptor.hasOwnProperty('transformCache')) {
+ if (hasOwn(operatorDescriptor, 'transform')) {
+ if (hasOwn(operatorDescriptor, 'transformCache')) {
const key = `${optionValue}`;
const transformCache = operatorDescriptor.transformCache;
- if (transformCache.hasOwnProperty(key)) {
+ if (hasOwn(transformCache, key)) {
optionValue = transformCache[key];
} else {
optionValue = operatorDescriptor.transform(optionValue);
@@ -93,23 +93,23 @@ function conditionsTestValue(descriptors, type, operator, optionValue, value) {
function conditionsClearCaches(descriptors) {
for (const type in descriptors) {
- if (!descriptors.hasOwnProperty(type)) {
+ if (!hasOwn(descriptors, type)) {
continue;
}
const conditionDescriptor = descriptors[type];
- if (conditionDescriptor.hasOwnProperty('transformCache')) {
+ if (hasOwn(conditionDescriptor, 'transformCache')) {
conditionDescriptor.transformCache = {};
}
const operatorDescriptors = conditionDescriptor.operators;
for (const operator in operatorDescriptors) {
- if (!operatorDescriptors.hasOwnProperty(operator)) {
+ if (!hasOwn(operatorDescriptors, operator)) {
continue;
}
const operatorDescriptor = operatorDescriptors[operator];
- if (operatorDescriptor.hasOwnProperty('transformCache')) {
+ if (hasOwn(operatorDescriptor, 'transformCache')) {
operatorDescriptor.transformCache = {};
}
}
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index 9b560f78..c53c9f77 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -137,7 +137,7 @@ class Database {
const visited = {};
const results = [];
const processRow = (row, index) => {
- if (titles.includes(row.dictionary) && !visited.hasOwnProperty(row.id)) {
+ if (titles.includes(row.dictionary) && !hasOwn(visited, row.id)) {
visited[row.id] = true;
results.push(Database.createTerm(row, index));
}
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js
index 9aa0af9c..affce9e9 100644
--- a/ext/bg/js/dictionary.js
+++ b/ext/bg/js/dictionary.js
@@ -81,7 +81,7 @@ function dictTermsUndupe(definitions) {
const definitionGroups = {};
for (const definition of definitions) {
const definitionExisting = definitionGroups[definition.id];
- if (!definitionGroups.hasOwnProperty(definition.id) || definition.expression.length > definitionExisting.expression.length) {
+ if (!hasOwn(definitionGroups, definition.id) || definition.expression.length > definitionExisting.expression.length) {
definitionGroups[definition.id] = definition;
}
}
@@ -131,7 +131,7 @@ function dictTermsGroup(definitions, dictionaries) {
}
const keyString = key.toString();
- if (groups.hasOwnProperty(keyString)) {
+ if (hasOwn(groups, keyString)) {
groups[keyString].push(definition);
} else {
groups[keyString] = [definition];
diff --git a/ext/bg/js/mecab.js b/ext/bg/js/mecab.js
index 246f8bba..297432e2 100644
--- a/ext/bg/js/mecab.js
+++ b/ext/bg/js/mecab.js
@@ -60,7 +60,7 @@ class Mecab {
}
onNativeMessage({sequence, data}) {
- if (this.listeners.hasOwnProperty(sequence)) {
+ if (hasOwn(this.listeners, sequence)) {
const {callback, timer} = this.listeners[sequence];
clearTimeout(timer);
callback(data);
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index 63d88789..358a6b45 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -336,7 +336,7 @@ function profileOptionsSetDefaults(options) {
const combine = (target, source) => {
for (const key in source) {
- if (!target.hasOwnProperty(key)) {
+ if (!hasOwn(target, key)) {
target[key] = source[key];
}
}
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index 0922d938..16cbfbbd 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -234,7 +234,7 @@ class DisplaySearch extends Display {
onRuntimeMessage({action, params}, sender, callback) {
const handlers = DisplaySearch.runtimeMessageHandlers;
- if (handlers.hasOwnProperty(action)) {
+ if (hasOwn(handlers, action)) {
const handler = handlers[action];
const result = handler(this, params);
callback(result);
diff --git a/ext/bg/js/settings-dictionaries.js b/ext/bg/js/settings-dictionaries.js
index ebd380ac..177379b0 100644
--- a/ext/bg/js/settings-dictionaries.js
+++ b/ext/bg/js/settings-dictionaries.js
@@ -81,7 +81,7 @@ class SettingsDictionaryListUI {
let changed = false;
let optionsDictionary;
const optionsDictionaries = this.optionsDictionaries;
- if (optionsDictionaries.hasOwnProperty(title)) {
+ if (hasOwn(optionsDictionaries, title)) {
optionsDictionary = optionsDictionaries[title];
} else {
optionsDictionary = SettingsDictionaryListUI.createDictionaryOptions();
@@ -466,7 +466,7 @@ function dictionaryErrorsShow(errors) {
for (let e of errors) {
console.error(e);
e = dictionaryErrorToString(e);
- uniqueErrors[e] = uniqueErrors.hasOwnProperty(e) ? uniqueErrors[e] + 1 : 1;
+ uniqueErrors[e] = hasOwn(uniqueErrors, e) ? uniqueErrors[e] + 1 : 1;
}
for (const e in uniqueErrors) {
diff --git a/ext/bg/js/settings-popup-preview.js b/ext/bg/js/settings-popup-preview.js
index 7d641c46..49409968 100644
--- a/ext/bg/js/settings-popup-preview.js
+++ b/ext/bg/js/settings-popup-preview.js
@@ -106,7 +106,7 @@ class SettingsPopupPreview {
onMessage(e) {
const {action, params} = e.data;
const handlers = SettingsPopupPreview.messageHandlers;
- if (handlers.hasOwnProperty(action)) {
+ if (hasOwn(handlers, action)) {
const handler = handlers[action];
handler(this, params);
}
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index e27cbdff..0a0ce663 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -297,7 +297,7 @@ class Translator {
for (const deinflection of deinflections) {
const term = deinflection.term;
let deinflectionArray;
- if (uniqueDeinflectionsMap.hasOwnProperty(term)) {
+ if (hasOwn(uniqueDeinflectionsMap, term)) {
deinflectionArray = uniqueDeinflectionsMap[term];
} else {
deinflectionArray = [];
@@ -355,7 +355,7 @@ class Translator {
const kanjiUnique = {};
const kanjiList = [];
for (const c of text) {
- if (!kanjiUnique.hasOwnProperty(c)) {
+ if (!hasOwn(kanjiUnique, c)) {
kanjiList.push(c);
kanjiUnique[c] = true;
}
@@ -417,7 +417,7 @@ class Translator {
const expression = term.expression;
term.frequencies = [];
- if (termsUniqueMap.hasOwnProperty(expression)) {
+ if (hasOwn(termsUniqueMap, expression)) {
termsUniqueMap[expression].push(term);
} else {
const termList = [term];
@@ -464,7 +464,7 @@ class Translator {
const category = meta.category;
const group = (
- stats.hasOwnProperty(category) ?
+ hasOwn(stats, category) ?
stats[category] :
(stats[category] = [])
);
@@ -484,7 +484,7 @@ class Translator {
async getTagMetaList(names, title) {
const tagMetaList = [];
const cache = (
- this.tagCache.hasOwnProperty(title) ?
+ hasOwn(this.tagCache, title) ?
this.tagCache[title] :
(this.tagCache[title] = {})
);
@@ -492,7 +492,7 @@ class Translator {
for (const name of names) {
const base = Translator.getNameBase(name);
- if (cache.hasOwnProperty(base)) {
+ if (hasOwn(cache, base)) {
tagMetaList.push(cache[base]);
} else {
const tagMeta = await this.database.findTagForTitle(base, title);
diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js
index 089c9422..ae54be00 100644
--- a/ext/fg/js/float.js
+++ b/ext/fg/js/float.js
@@ -49,7 +49,7 @@ class DisplayFloat extends Display {
onMessage(e) {
const {action, params} = e.data;
const handlers = DisplayFloat.messageHandlers;
- if (handlers.hasOwnProperty(action)) {
+ if (hasOwn(handlers, action)) {
const handler = handlers[action];
handler(this, params);
}
@@ -58,7 +58,7 @@ class DisplayFloat extends Display {
onKeyDown(e) {
const key = Display.getKeyFromEvent(e);
const handlers = DisplayFloat.onKeyDownHandlers;
- if (handlers.hasOwnProperty(key)) {
+ if (hasOwn(handlers, key)) {
const handler = handlers[key];
if (handler(this, e)) {
e.preventDefault();
diff --git a/ext/fg/js/frontend-api-receiver.js b/ext/fg/js/frontend-api-receiver.js
index fbfb3ab0..bde14646 100644
--- a/ext/fg/js/frontend-api-receiver.js
+++ b/ext/fg/js/frontend-api-receiver.js
@@ -34,7 +34,7 @@ class FrontendApiReceiver {
onMessage(port, {id, action, params, target, senderId}) {
if (
target !== this.source ||
- !this.handlers.hasOwnProperty(action)
+ !hasOwn(this.handlers, action)
) {
return;
}
diff --git a/ext/fg/js/frontend-api-sender.js b/ext/fg/js/frontend-api-sender.js
index c6eeaeb2..af998a8f 100644
--- a/ext/fg/js/frontend-api-sender.js
+++ b/ext/fg/js/frontend-api-sender.js
@@ -78,7 +78,7 @@ class FrontendApiSender {
}
onAck(id) {
- if (!this.callbacks.hasOwnProperty(id)) {
+ if (!hasOwn(this.callbacks, id)) {
console.warn(`ID ${id} not found for ack`);
return;
}
@@ -95,7 +95,7 @@ class FrontendApiSender {
}
onResult(id, data) {
- if (!this.callbacks.hasOwnProperty(id)) {
+ if (!hasOwn(this.callbacks, id)) {
console.warn(`ID ${id} not found`);
return;
}
@@ -118,7 +118,7 @@ class FrontendApiSender {
}
onError(id, reason) {
- if (!this.callbacks.hasOwnProperty(id)) { return; }
+ if (!hasOwn(this.callbacks, id)) { return; }
const info = this.callbacks[id];
delete this.callbacks[id];
info.timer = null;
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index ee653d78..16302e82 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -237,7 +237,7 @@ class Frontend {
onWindowMessage(e) {
const action = e.data;
const handlers = Frontend.windowMessageHandlers;
- if (handlers.hasOwnProperty(action)) {
+ if (hasOwn(handlers, action)) {
const handler = handlers[action];
handler(this);
}
@@ -245,7 +245,7 @@ class Frontend {
onRuntimeMessage({action, params}, sender, callback) {
const handlers = Frontend.runtimeMessageHandlers;
- if (handlers.hasOwnProperty(action)) {
+ if (hasOwn(handlers, action)) {
const handler = handlers[action];
const result = handler(this, params);
callback(result);
diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js
index d8dec4df..b2f18b97 100644
--- a/ext/fg/js/popup-proxy-host.js
+++ b/ext/fg/js/popup-proxy-host.js
@@ -50,7 +50,7 @@ class PopupProxyHost {
}
createPopup(parentId, depth) {
- const parent = (typeof parentId === 'string' && this.popups.hasOwnProperty(parentId) ? this.popups[parentId] : null);
+ const parent = (typeof parentId === 'string' && hasOwn(this.popups, parentId) ? this.popups[parentId] : null);
const id = `${this.nextId}`;
if (parent !== null) {
depth = parent.depth + 1;
@@ -70,7 +70,7 @@ class PopupProxyHost {
}
getPopup(id) {
- if (!this.popups.hasOwnProperty(id)) {
+ if (!hasOwn(this.popups, id)) {
throw new Error('Invalid popup ID');
}
diff --git a/ext/mixed/js/audio.js b/ext/mixed/js/audio.js
index 4e9d04fa..7d5ffedd 100644
--- a/ext/mixed/js/audio.js
+++ b/ext/mixed/js/audio.js
@@ -113,7 +113,7 @@ function audioGetFromUrl(url, willDownload) {
async function audioGetFromSources(expression, sources, optionsContext, willDownload, cache=null) {
const key = `${expression.expression}:${expression.reading}`;
- if (cache !== null && cache.hasOwnProperty(expression)) {
+ if (cache !== null && hasOwn(cache, expression)) {
return cache[key];
}
diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js
index 8a8a2368..d82b9b4b 100644
--- a/ext/mixed/js/core.js
+++ b/ext/mixed/js/core.js
@@ -94,6 +94,10 @@ function isObject(value) {
return typeof value === 'object' && value !== null && !Array.isArray(value);
}
+function hasOwn(object, property) {
+ return Object.prototype.hasOwnProperty.call(object, property);
+}
+
// toIterable is required on Edge for cross-window origin objects.
function toIterable(value) {
if (typeof Symbol !== 'undefined' && typeof value[Symbol.iterator] !== 'undefined') {
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 854418f4..ce43b22c 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -194,7 +194,7 @@ class Display {
onKeyDown(e) {
const key = Display.getKeyFromEvent(e);
const handlers = Display.onKeyDownHandlers;
- if (handlers.hasOwnProperty(key)) {
+ if (hasOwn(handlers, key)) {
const handler = handlers[key];
if (handler(this, e)) {
e.preventDefault();
@@ -216,7 +216,7 @@ class Display {
onRuntimeMessage({action, params}, sender, callback) {
const handlers = Display.runtimeMessageHandlers;
- if (handlers.hasOwnProperty(action)) {
+ if (hasOwn(handlers, action)) {
const handler = handlers[action];
const result = handler(this, params);
callback(result);