@appliedblockchain/helpers
Advanced tools
Comparing version 3.0.2 to 3.1.1
# Changelog | ||
## [v3.1.1](../../compare/v3.1.0...v3.1.1) (2019-11-06) | ||
* Bumping flow. | ||
* Adding web-socket-ready-state helper. | ||
* Updating type for indexed-by-key as flow has problems with nulls. | ||
* Updating changelog. | ||
## [v3.1.0](../../compare/v3.0.2...v3.1.0) (2019-09-10) | ||
* Switching from `JSON.stringify` to `inspect` on default logger... | ||
* Updating changelog. | ||
## [v3.0.2](../../compare/v3.0.1...v3.0.2) (2019-08-21) | ||
@@ -4,0 +16,0 @@ |
@@ -5,4 +5,4 @@ // @flow | ||
Non-existing keys will be indexed under `undefined` key. */ | ||
function indexedByKey/*:: <K: string, T: { [K]: string }> */(xs /*: T[] */, key /*: K */) /*: { [string]: T } */ { | ||
return xs.reduce((r, _) => { | ||
function indexedByKey/*:: <T: {}> */(values /*: T[] */, key /*: string */) /*: { [string]: T } */ { | ||
return values.reduce((r, _) => { | ||
r[_[key]] = _ | ||
@@ -9,0 +9,0 @@ return r |
// @flow | ||
const os = require('os') | ||
const { inspect } = require('util') | ||
const { keys } = Object | ||
const isString = require('./is-string') | ||
const os = require('os') | ||
@@ -67,3 +68,3 @@ /*:: | ||
const modLevels = (process.env.LOG || 'off') | ||
const modLevels /*: { [string]: number } */ = (process.env.LOG || 'off') | ||
.split(',') | ||
@@ -74,3 +75,3 @@ .map(entry => entry.includes('=') ? | ||
) | ||
.reduce((r, [ k, v ]) => ({ ...r, [k]: levels[v] || levels.off }), {}) | ||
.reduce((r /*: any */, [ k, v ]) => ({ ...r, [k]: levels[v] || levels.off }), {}) | ||
@@ -86,3 +87,3 @@ function noop() {} | ||
return JSON.stringify( | ||
args.reduce((r, e) => Object.assign(r, typeof e === 'string' ? { msg: e } : e), { pid, hostname, time, level, name, v: 0 }) | ||
args.reduce((r /*: any */, e) => Object.assign(r, typeof e === 'string' ? { msg: e } : e), { pid, hostname, time, level, name, v: 0 }) | ||
) | ||
@@ -92,4 +93,4 @@ } | ||
const targets = { | ||
console: targetMethods.reduce((r, k) => ({ ...r, [k]: (time, level, mod, ...rest) => console[k](`[${time}]`, `${labelOfLevel[level].padStart(5, ' ')}:`, `${mod}/${pid}`, `on ${hostname}:`, ...rest.map(_ => isString(_) ? _ : JSON.stringify(_))) }), {}), | ||
bunyan: targetMethods.reduce((r, k) => ({ ...r, [k]: (...args) => console[k](jsonOf(...args)) }), {}) | ||
console: targetMethods.reduce((r /*: any */, k /*: any */) => ({ ...r, [k]: (time, level, mod, ...rest) => console[k](`[${time}]`, `${labelOfLevel[level].padStart(5, ' ')}:`, `${mod}/${pid}`, `on ${hostname}:`, ...rest.map(_ => isString(_) ? _ : inspect(_))) }), {}), | ||
bunyan: targetMethods.reduce((r /*: any */, k /*: any */) => ({ ...r, [k]: (...args) => console[k](jsonOf(...args)) }), {}) | ||
} | ||
@@ -96,0 +97,0 @@ |
{ | ||
"name": "@appliedblockchain/helpers", | ||
"version": "3.0.2", | ||
"version": "3.1.1", | ||
"description": "No dependency, single file helpers.", | ||
@@ -25,4 +25,4 @@ "main": "index.js", | ||
"@appliedblockchain/eslint-config": "2.6.0", | ||
"eslint": "6.2.1", | ||
"flow-bin": "0.105.2" | ||
"eslint": "6.6.0", | ||
"flow-bin": "0.111.3" | ||
}, | ||
@@ -29,0 +29,0 @@ "eslintConfig": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
127332
114
3385
5