Comparing version 0.0.16 to 0.0.17
45
main.js
@@ -13,2 +13,6 @@ // standardjs | ||
return (typeof v !== 'undefined' || v !== null) | ||
}, | ||
onBrowser: function () { | ||
return (typeof window !== 'undefined' && typeof module === 'undefined') | ||
} | ||
@@ -24,6 +28,26 @@ }, | ||
Log: function (params) { | ||
var __segments = params.segments | ||
var __levels = params.levels | ||
// @todo const __mode = params.mode console, file, email ... | ||
var __segments | ||
var __levels | ||
var __browser | ||
var MARKER_SUCCESS, MARKER_ERROR, MARKER_INFO, MARKER_WARNING | ||
var __init = function (params) { | ||
__segments = params.segments | ||
__levels = params.levels | ||
__browser = tools.core.onBrowser() | ||
// @todo const __mode = params.mode console, file, email ... | ||
MARKER_SUCCESS = '✔' // ✔ ✔️ | ||
MARKER_ERROR = '✗️' | ||
MARKER_INFO = 'ℹ️' | ||
MARKER_WARNING = '❗️️' | ||
if (!__browser) { | ||
var colors = require('colors') | ||
MARKER_SUCCESS = colors.green(MARKER_SUCCESS) | ||
MARKER_ERROR = colors.red(MARKER_ERROR) | ||
MARKER_INFO = colors.blue(MARKER_INFO) | ||
MARKER_WARNING = colors.yellow(MARKER_WARNING) | ||
} else { | ||
} | ||
} | ||
var verbose = function (segment, level) { | ||
@@ -33,7 +57,13 @@ if ((__segments === '*' || tools.array.contains(__segments, segment)) && | ||
var _args = Array.prototype.slice.call(arguments) | ||
if (level === 'error') { | ||
if (level === tools.Log.level.ERROR) { | ||
_args[1] = MARKER_ERROR | ||
console.error.apply(console, _args) | ||
} else if (level === 'warning') { | ||
} else if (level === tools.Log.level.WARNING) { | ||
_args[1] = MARKER_WARNING | ||
console.warn.apply(console, _args) | ||
} else if (level === tools.Log.level.SUCCESS) { | ||
_args[1] = MARKER_SUCCESS | ||
console.log.apply(console, _args) | ||
} else { | ||
_args[1] = MARKER_INFO | ||
console.log.apply(console, _args) | ||
@@ -44,2 +74,4 @@ } | ||
__init(params) | ||
return { | ||
@@ -568,3 +600,4 @@ verbose: verbose | ||
WARNING: 'WARNING', | ||
INFO: 'INFO' | ||
INFO: 'INFO', | ||
SUCCESS: 'SUCCESS' | ||
} | ||
@@ -571,0 +604,0 @@ |
{ | ||
"name": "a-toolbox", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "lightweight tools", | ||
"keywords": [ | ||
"tools", | ||
"log", | ||
"lib", | ||
@@ -34,2 +35,5 @@ "misc", | ||
"main": "main", | ||
"dependencies" : { | ||
"colors": "x" | ||
}, | ||
"devDependencies": { | ||
@@ -36,0 +40,0 @@ "standard": "x", |
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
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
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
27245
660
1
2
+ Addedcolors@x
+ Addedcolors@1.4.0(transitive)