summaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/json-schema.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/bg/js/json-schema.js b/ext/bg/js/json-schema.js
index 5d596a8b..2b7c9f27 100644
--- a/ext/bg/js/json-schema.js
+++ b/ext/bg/js/json-schema.js
@@ -131,19 +131,19 @@ class JsonSchemaProxyHandler {
case 'object':
{
const properties = schema.properties;
- if (properties !== null && typeof properties === 'object' && !Array.isArray(properties)) {
+ if (JsonSchemaProxyHandler.isObject(properties)) {
if (Object.prototype.hasOwnProperty.call(properties, property)) {
return properties[property];
}
}
const additionalProperties = schema.additionalProperties;
- return (additionalProperties !== null && typeof additionalProperties === 'object' && !Array.isArray(additionalProperties)) ? additionalProperties : null;
+ return JsonSchemaProxyHandler.isObject(additionalProperties) ? additionalProperties : null;
}
case 'array':
{
const items = schema.items;
- return (items !== null && typeof items === 'object' && !Array.isArray(items)) ? items : null;
+ return JsonSchemaProxyHandler.isObject(items) ? items : null;
}
default:
return null;
@@ -399,6 +399,10 @@ class JsonSchemaProxyHandler {
return value;
}
+
+ static isObject(value) {
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
+ }
}
class JsonSchema {