diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-26 17:33:09 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-26 17:33:09 -0500 |
commit | 099847729c471c3ff6e8c28673114eae81c6a4f4 (patch) | |
tree | 91fd1ee3268e526712e49fe570cdfc9277a03ddc | |
parent | 7e94fca7c7a07f94de40ddeb56a3f06e43000e25 (diff) |
utilIsObject => isObject, move to core.js
-rw-r--r-- | ext/bg/js/options.js | 4 | ||||
-rw-r--r-- | ext/bg/js/util.js | 4 | ||||
-rw-r--r-- | ext/mixed/js/core.js | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index b9bf85f3..63d88789 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -389,7 +389,7 @@ function optionsUpdateVersion(options, defaultProfileOptions) { // Remove invalid const profiles = options.profiles; for (let i = profiles.length - 1; i >= 0; --i) { - if (!utilIsObject(profiles[i])) { + if (!isObject(profiles[i])) { profiles.splice(i, 1); } } @@ -440,7 +440,7 @@ function optionsLoad() { }).then(optionsStr => { if (typeof optionsStr === 'string') { const options = JSON.parse(optionsStr); - if (utilIsObject(options)) { + if (isObject(options)) { return options; } } diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index b9e602b3..c21fd68c 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -111,7 +111,3 @@ function utilReadFile(file) { reader.readAsBinaryString(file); }); } - -function utilIsObject(value) { - return typeof value === 'object' && value !== null && !Array.isArray(value); -} diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js index 12ed9c1f..513d6211 100644 --- a/ext/mixed/js/core.js +++ b/ext/mixed/js/core.js @@ -148,3 +148,7 @@ function stringReplaceAsync(str, regex, replacer) { parts.push(str.substring(index)); return Promise.all(parts).then(v => v.join('')); } + +function isObject(value) { + return typeof value === 'object' && value !== null && !Array.isArray(value); +} |