Comparing version 1.1.0 to 1.1.1
@@ -6,2 +6,3 @@ 'use strict'; | ||
var nodeEnv = "development"; | ||
var prefixArgs = [[" " + nodeEnv + " ", "background-color: " + ( '#f00') + "; color: #fff;"]]; | ||
function consolev() { | ||
@@ -14,3 +15,3 @@ var _console; | ||
args = args.map(function (arg) { | ||
var consolevArgs = args.map(function (arg) { | ||
return Array.isArray(arg) ? arg : [arg]; | ||
@@ -20,4 +21,3 @@ }).filter(function (arg) { | ||
}); | ||
var prefixArgs = [[" " + nodeEnv + " ", "background-color: " + ( '#f00') + "; color: #fff;"]]; | ||
var optionalArgs = [].concat(prefixArgs, args); | ||
var optionalArgs = [].concat(prefixArgs, consolevArgs); | ||
var message = '%c%s%c '.repeat(optionalArgs.length); | ||
@@ -24,0 +24,0 @@ var optionalParams = optionalArgs.map(function (arg) { |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(){for(var r,o=arguments.length,t=new Array(o),e=0;e<o;e++)t[e]=arguments[e];t=t.map((function(r){return Array.isArray(r)?r:[r]})).filter((function(r){return void 0!==r[0]}));var n=[[" production ","background-color: #000; color: #fff;"]],c=[].concat(n,t),a="%c%s%c ".repeat(c.length),l=c.map((function(r){var o;return[null!=(o=r[1])?o:"",r[0],""]})).flat();(r=console).log.apply(r,[a].concat(l))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=[[" production ","background-color: #000; color: #fff;"]];exports.default=function(){for(var o,t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var a=e.map((function(r){return Array.isArray(r)?r:[r]})).filter((function(r){return void 0!==r[0]})),c=[].concat(r,a),l="%c%s%c ".repeat(c.length),u=c.map((function(r){var o;return[null!=(o=r[1])?o:"",r[0],""]})).flat();(o=console).log.apply(o,[l].concat(u))}; | ||
//# sourceMappingURL=consolev.cjs.production.min.js.map |
var nodeEnv = process.env.NODE_ENV; | ||
var prefixArgs = [[" " + nodeEnv + " ", "background-color: " + (nodeEnv === 'production' ? '#000' : '#f00') + "; color: #fff;"]]; | ||
function consolev() { | ||
@@ -9,3 +10,3 @@ var _console; | ||
args = args.map(function (arg) { | ||
var consolevArgs = args.map(function (arg) { | ||
return Array.isArray(arg) ? arg : [arg]; | ||
@@ -15,4 +16,3 @@ }).filter(function (arg) { | ||
}); | ||
var prefixArgs = [[" " + nodeEnv + " ", "background-color: " + (nodeEnv === 'production' ? '#000' : '#f00') + "; color: #fff;"]]; | ||
var optionalArgs = [].concat(prefixArgs, args); | ||
var optionalArgs = [].concat(prefixArgs, consolevArgs); | ||
var message = '%c%s%c '.repeat(optionalArgs.length); | ||
@@ -19,0 +19,0 @@ var optionalParams = optionalArgs.map(function (arg) { |
@@ -1,2 +0,4 @@ | ||
export declare type ConsolevArg = [message: string, style?: string] | string; | ||
export default function consolev(...args: ConsolevArg[]): void; | ||
export declare type ConsolevArgMessage = string | boolean | null | undefined; | ||
export declare type ConsolevArg = [message: ConsolevArgMessage, style?: string]; | ||
export declare type ConsolevArgLike = ConsolevArg | ConsolevArgMessage; | ||
export default function consolev(...args: ConsolevArgLike[]): void; |
{ | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -1,19 +0,25 @@ | ||
export type ConsolevArg = [message: string, style?: string] | string; | ||
export type ConsolevArgMessage = string | boolean | null | undefined; | ||
export type ConsolevArg = [message: ConsolevArgMessage, style?: string]; | ||
export type ConsolevArgLike = ConsolevArg | ConsolevArgMessage; | ||
const nodeEnv = process.env.NODE_ENV; | ||
export default function consolev(...args: ConsolevArg[]) { | ||
args = args | ||
const prefixArgs: ConsolevArg[] = [ | ||
[ | ||
` ${nodeEnv} `, | ||
`background-color: ${ | ||
nodeEnv === 'production' ? '#000' : '#f00' | ||
}; color: #fff;`, | ||
], | ||
]; | ||
export default function consolev(...args: ConsolevArgLike[]) { | ||
const consolevArgs = args | ||
.map((arg) => (Array.isArray(arg) ? arg : ([arg] as ConsolevArg))) | ||
.filter((arg) => arg[0] !== void 0); | ||
const prefixArgs: ConsolevArg[] = [ | ||
[ | ||
` ${nodeEnv} `, | ||
`background-color: ${ | ||
nodeEnv === 'production' ? '#000' : '#f00' | ||
}; color: #fff;`, | ||
], | ||
]; | ||
const optionalArgs = [...prefixArgs, ...args]; | ||
const optionalArgs = [...prefixArgs, ...consolevArgs]; | ||
const message = '%c%s%c '.repeat(optionalArgs.length); | ||
@@ -20,0 +26,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14820
82