Fixed const reassignment error
This commit is contained in:
parent
682ee2cd5f
commit
959d44851b
1 changed files with 21 additions and 15 deletions
|
|
@ -6,7 +6,27 @@ import {
|
||||||
} from './util.js';
|
} from './util.js';
|
||||||
import template from './templates.js';
|
import template from './templates.js';
|
||||||
|
|
||||||
const {stdout: stdoutColor, stderr: stderrColor} = supportsColor;
|
// True for any Browser or WebWorker
|
||||||
|
// copied from https://github.com/flexdinesh/browser-or-node/blob/master/src/index.js available under the MIT license
|
||||||
|
const isBrowser =
|
||||||
|
(typeof window !== "undefined" && typeof window.document !== "undefined")
|
||||||
|
||
|
||||||
|
(typeof self === "object" &&
|
||||||
|
self.constructor &&
|
||||||
|
self.constructor.name === "DedicatedWorkerGlobalScope");
|
||||||
|
|
||||||
|
// Overwrite SupportsColor if we are running in Browser or WebWorker
|
||||||
|
const { stdout: stdoutColor, stderr: stderrColor } = !isBrowser
|
||||||
|
? supportsColor
|
||||||
|
: {
|
||||||
|
stdout: {
|
||||||
|
level: 3,
|
||||||
|
},
|
||||||
|
stderr: {
|
||||||
|
level: 3,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const {isArray} = Array;
|
const {isArray} = Array;
|
||||||
|
|
||||||
const GENERATOR = Symbol('GENERATOR');
|
const GENERATOR = Symbol('GENERATOR');
|
||||||
|
|
@ -21,20 +41,6 @@ const levelMapping = [
|
||||||
'ansi16m',
|
'ansi16m',
|
||||||
];
|
];
|
||||||
|
|
||||||
// True for any Browser or WebWorker
|
|
||||||
// copied from https://github.com/flexdinesh/browser-or-node/blob/master/src/index.js available under the MIT license
|
|
||||||
const isBrowser =
|
|
||||||
(typeof window !== "undefined" && typeof window.document !== "undefined")
|
|
||||||
||
|
|
||||||
(typeof self === "object" &&
|
|
||||||
self.constructor &&
|
|
||||||
self.constructor.name === "DedicatedWorkerGlobalScope");
|
|
||||||
|
|
||||||
if(isBrowser)
|
|
||||||
{
|
|
||||||
stderrColor = stdoutColor = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
const styles = Object.create(null);
|
const styles = Object.create(null);
|
||||||
|
|
||||||
const applyOptions = (object, options = {}) => {
|
const applyOptions = (object, options = {}) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue