Add utility method for checking if a value is a standard object

This commit is contained in:
toasted-nutbread 2019-09-07 17:35:33 -04:00
parent 05ce350792
commit c4e6d7e3d1
2 changed files with 5 additions and 1 deletions

View File

@ -330,7 +330,7 @@ function optionsLoad() {
}).then(optionsStr => {
if (typeof optionsStr === 'string') {
const options = JSON.parse(optionsStr);
if (typeof options === 'object' && options !== null && !Array.isArray(options)) {
if (utilIsObject(options)) {
return options;
}
}

View File

@ -104,3 +104,7 @@ function utilReadFile(file) {
reader.readAsBinaryString(file);
});
}
function utilIsObject(value) {
return typeof value === 'object' && value !== null && !Array.isArray(value);
}