using isObject() instead of typeof

This commit is contained in:
pypy
2020-01-11 22:55:35 +09:00
parent 9fbac82505
commit c0f66ac064
2 changed files with 9 additions and 8 deletions
+8 -7
View File
@@ -305,7 +305,7 @@ if (window.CefSharp) {
text: escapeTag(json.success.message) text: escapeTag(json.success.message)
}).show(); }).show();
} }
} else if (typeof json.error === 'object') { } else if (isObject(json.error)) {
this.$throw( this.$throw(
json.error.status_code || res.status, json.error.status_code || res.status,
json.error.message, json.error.message,
@@ -909,7 +909,7 @@ if (window.CefSharp) {
if (ctx) { if (ctx) {
var prop = {}; var prop = {};
for (var key in ctx) { for (var key in ctx) {
if (typeof ctx[key] !== 'object') { if (isObject(ctx[key]) === false) {
prop[key] = true; prop[key] = true;
} }
} }
@@ -919,7 +919,7 @@ if (window.CefSharp) {
ctx.location_ = this.parseLocation(ctx.location); ctx.location_ = this.parseLocation(ctx.location);
} }
for (var key in ctx) { for (var key in ctx) {
if (typeof ctx[key] !== 'object') { if (isObject(ctx[key]) === false) {
prop[key] = true; prop[key] = true;
} }
} }
@@ -1665,15 +1665,16 @@ if (window.CefSharp) {
details: {}, details: {},
seen: false, seen: false,
created_at: '', created_at: '',
//
...ref ...ref
}; };
this.notification[ctx.id] = ctx; this.notification[ctx.id] = ctx;
} }
if (typeof ctx.details !== 'object') { if (isObject(ctx.details)) {
var details = {}; var details = {};
try { try {
var json = JSON.parse(ctx.details); var json = JSON.parse(ctx.details);
if (typeof json === 'object') { if (isObject(json)) {
details = json; details = json;
} }
} catch (err) { } catch (err) {
@@ -3399,11 +3400,11 @@ if (window.CefSharp) {
var node = []; var node = [];
for (var key in json) { for (var key in json) {
var value = json[key]; var value = json[key];
if (typeof value === 'object') { if (isObject(value)) {
if (Array.isArray(value)) { if (Array.isArray(value)) {
node.push({ node.push({
children: value.map((val, idx) => { children: value.map((val, idx) => {
if (typeof val === 'object') { if (isObject(val)) {
return { return {
children: buildTreeData(val), children: buildTreeData(val),
key: idx key: idx
+1 -1
View File
@@ -255,7 +255,7 @@ if (window.CefSharp) {
text: escapeTag(json.success.message) text: escapeTag(json.success.message)
}).show(); }).show();
} }
} else if (typeof json.error === 'object') { } else if (isObject(json.error)) {
this.$throw( this.$throw(
json.error.status_code || res.status, json.error.status_code || res.status,
json.error.message, json.error.message,