From eb0f7615aaf87bfdf867c390b2cac4794abf6871 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Fri, 22 Apr 2022 13:34:42 +0800 Subject: [PATCH] chore: lint --- packages/vue-cli-plugin-uni/util/console.js | 54 ++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/packages/vue-cli-plugin-uni/util/console.js b/packages/vue-cli-plugin-uni/util/console.js index 7649a5407..a042f0ecb 100644 --- a/packages/vue-cli-plugin-uni/util/console.js +++ b/packages/vue-cli-plugin-uni/util/console.js @@ -1,28 +1,28 @@ -const ZERO_WIDTH_CHAR = { - NOTE: '', - WARNING: '\u200B', - ERROR: '\u200C', - backup0: '\u200D', - backup1: '\u200E', - backup2: '\u200F', - backup3: '\uFEFF' +const ZERO_WIDTH_CHAR = { + NOTE: '', + WARNING: '\u200B', + ERROR: '\u200C', + backup0: '\u200D', + backup1: '\u200E', + backup2: '\u200F', + backup3: '\uFEFF' +} + +function overridedConsole (name, oldFn, char) { + console[name] = function (...args) { + oldFn.apply(this, args.map(arg => { + let item + if (typeof arg !== 'object') { + item = `${char}${arg}${char}` + } else { + item = `${char}${JSON.stringify(arg)}${char}` + } + + return item + })) + } +} +if (typeof console !== 'undefined') { + overridedConsole('warn', console.warn, ZERO_WIDTH_CHAR.WARNING) + // overridedConsole('error', console.error, ZERO_WIDTH_CHAR.ERROR) } - -if (console) { - function overridedConsole(name, oldFn, char) { - console[name] = function (...args) { - oldFn.apply(this, args.map(arg => { - let item - if (typeof arg !== 'object') { - item = `${char}${arg}${char}` - } else { - item = `${char}${JSON.stringify(arg)}${char}` - } - - return item - })) - } - } - overridedConsole('warn', console.warn, ZERO_WIDTH_CHAR.WARNING) - // overridedConsole('error', console.error, ZERO_WIDTH_CHAR.ERROR) -} \ No newline at end of file -- GitLab