Skip to content

Commit

Permalink
fix duplicated output, which was caused by wrong browser detection (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
xxczaki committed Aug 28, 2019
1 parent 175a28c commit 14a83d6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface Options {
}

exports.success = (text: string) => {
if (typeof window === 'undefined') {
if (typeof window !== 'undefined') {
console.log(' %cSUCCESS', `%c${text}`, 'background: green; border-radius: 2px');
}

Expand All @@ -26,7 +26,7 @@ exports.success = (text: string) => {
};

exports.info = (text: string) => {
if (typeof window === 'undefined') {
if (typeof window !== 'undefined') {
console.log(' %cINFO', `%c${text}`, 'background: blue; border-radius: 2px');
}

Expand All @@ -42,7 +42,7 @@ exports.info = (text: string) => {
};

exports.warning = (text: string) => {
if (typeof window === 'undefined') {
if (typeof window !== 'undefined') {
console.log(' %cWARNING', `%c${text}`, 'background: yellow; border-radius: 2px');
}

Expand All @@ -58,7 +58,7 @@ exports.warning = (text: string) => {
};

exports.error = (text: string) => {
if (typeof window === 'undefined') {
if (typeof window !== 'undefined') {
console.log(' %cERROR', `%c${text}`, 'background: red; border-radius: 2px');
}

Expand All @@ -77,7 +77,7 @@ exports.custom = (title: string, text: string, {titleColor, backgroundColor}: Op
const color = Color(titleColor).hex();
const bgColor = Color(backgroundColor).hex();

if (typeof window === 'undefined') {
if (typeof window !== 'undefined') {
console.log(` %c${title}`, `%c${text}`, `color: ${color || 'white'}; background: ${bgColor || 'black'}; border-radius: 2px`);
}

Expand Down

0 comments on commit 14a83d6

Please sign in to comment.