@scalecube/utils
Advanced tools
Comparing version 0.0.2-alpha.7 to 0.0.2-alpha.8
@@ -5,2 +5,3 @@ import * as check from './check'; | ||
import { addWorker, removeWorker } from './connectWorkers'; | ||
export { check, getFullAddress, validateAddress, constants, getAddress, addWorker, removeWorker }; | ||
import { saveToLogs } from './logs'; | ||
export { check, getFullAddress, validateAddress, constants, getAddress, addWorker, removeWorker, saveToLogs }; |
@@ -187,2 +187,29 @@ var assert = function (predicate, msg) { | ||
export { addWorker, check, constants, getAddress, getFullAddress, removeWorker, validateAddress }; | ||
var colorsMap = {}; | ||
var getRandomColor = function () { | ||
var letters = '0123456789ABCDEF'; | ||
var color = '#'; | ||
for (var i = 0; i < 6; i++) { | ||
color += letters[Math.floor(Math.random() * 16)]; | ||
} | ||
return color; | ||
}; | ||
var saveToLogs = function (identifier, msg, extra, debug) { | ||
if (!colorsMap[identifier]) { | ||
colorsMap[identifier] = getRandomColor(); | ||
} | ||
// tslint:disable | ||
if (debug) { | ||
var logColor = "color:" + colorsMap[identifier]; | ||
extra && console.log('%c************************', logColor); | ||
console.log(msg); | ||
extra && | ||
Object.keys(extra).forEach(function (key) { | ||
console.log(key + ": " + JSON.stringify(extra[key], null, 4)); | ||
}); | ||
extra && console.log('%c************************', logColor); | ||
} | ||
// tslint:enable | ||
}; | ||
export { addWorker, check, constants, getAddress, getFullAddress, removeWorker, saveToLogs, validateAddress }; |
@@ -5,2 +5,3 @@ import * as check from './check'; | ||
import { addWorker, removeWorker } from './connectWorkers'; | ||
export { check, getFullAddress, validateAddress, constants, getAddress, addWorker, removeWorker }; | ||
import { saveToLogs } from './logs'; | ||
export { check, getFullAddress, validateAddress, constants, getAddress, addWorker, removeWorker, saveToLogs }; |
@@ -191,2 +191,29 @@ 'use strict'; | ||
var colorsMap = {}; | ||
var getRandomColor = function () { | ||
var letters = '0123456789ABCDEF'; | ||
var color = '#'; | ||
for (var i = 0; i < 6; i++) { | ||
color += letters[Math.floor(Math.random() * 16)]; | ||
} | ||
return color; | ||
}; | ||
var saveToLogs = function (identifier, msg, extra, debug) { | ||
if (!colorsMap[identifier]) { | ||
colorsMap[identifier] = getRandomColor(); | ||
} | ||
// tslint:disable | ||
if (debug) { | ||
var logColor = "color:" + colorsMap[identifier]; | ||
extra && console.log('%c************************', logColor); | ||
console.log(msg); | ||
extra && | ||
Object.keys(extra).forEach(function (key) { | ||
console.log(key + ": " + JSON.stringify(extra[key], null, 4)); | ||
}); | ||
extra && console.log('%c************************', logColor); | ||
} | ||
// tslint:enable | ||
}; | ||
exports.addWorker = addWorker; | ||
@@ -198,2 +225,3 @@ exports.check = check; | ||
exports.removeWorker = removeWorker; | ||
exports.saveToLogs = saveToLogs; | ||
exports.validateAddress = validateAddress; |
{ | ||
"name": "@scalecube/utils", | ||
"version": "0.0.2-alpha.7", | ||
"version": "0.0.2-alpha.8", | ||
"private": false, | ||
@@ -37,5 +37,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@scalecube/api": "^0.0.2-alpha.7" | ||
"@scalecube/api": "^0.0.2-alpha.8" | ||
}, | ||
"gitHead": "ae962d62c4deb8016761bc7e0c9a1c6aac1648e2" | ||
"gitHead": "e2f5e84083dbfd8a5c15f465c191335dc539472b" | ||
} |
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
34887
17
511