utilIsObject => isObject, move to core.js
This commit is contained in:
parent
7e94fca7c7
commit
099847729c
@ -389,7 +389,7 @@ function optionsUpdateVersion(options, defaultProfileOptions) {
|
|||||||
// Remove invalid
|
// Remove invalid
|
||||||
const profiles = options.profiles;
|
const profiles = options.profiles;
|
||||||
for (let i = profiles.length - 1; i >= 0; --i) {
|
for (let i = profiles.length - 1; i >= 0; --i) {
|
||||||
if (!utilIsObject(profiles[i])) {
|
if (!isObject(profiles[i])) {
|
||||||
profiles.splice(i, 1);
|
profiles.splice(i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -440,7 +440,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 (utilIsObject(options)) {
|
if (isObject(options)) {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,3 @@ function utilReadFile(file) {
|
|||||||
reader.readAsBinaryString(file);
|
reader.readAsBinaryString(file);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function utilIsObject(value) {
|
|
||||||
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
||||||
}
|
|
||||||
|
@ -148,3 +148,7 @@ function stringReplaceAsync(str, regex, replacer) {
|
|||||||
parts.push(str.substring(index));
|
parts.push(str.substring(index));
|
||||||
return Promise.all(parts).then(v => v.join(''));
|
return Promise.all(parts).then(v => v.join(''));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isObject(value) {
|
||||||
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user