Add utility method for checking if a value is a standard object
This commit is contained in:
parent
05ce350792
commit
c4e6d7e3d1
@ -330,7 +330,7 @@ function optionsLoad() {
|
|||||||
}).then(optionsStr => {
|
}).then(optionsStr => {
|
||||||
if (typeof optionsStr === 'string') {
|
if (typeof optionsStr === 'string') {
|
||||||
const options = JSON.parse(optionsStr);
|
const options = JSON.parse(optionsStr);
|
||||||
if (typeof options === 'object' && options !== null && !Array.isArray(options)) {
|
if (utilIsObject(options)) {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,3 +104,7 @@ function utilReadFile(file) {
|
|||||||
reader.readAsBinaryString(file);
|
reader.readAsBinaryString(file);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function utilIsObject(value) {
|
||||||
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user