Remove chalk dependency (#728)
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 3.6.2-x
|
||||
|
||||
Changes:
|
||||
|
||||
- Remove the use of `chalk` (logger) for less overall dependencies
|
||||
|
||||
|
||||
## 3.6.1 Oct 18, 2020
|
||||
|
||||
Contributed:
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^5.1.3",
|
||||
"camelcase": "^5.3.1",
|
||||
"chalk": "^4.1.0",
|
||||
"ip-regex": "^4.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
import { Logger, Logger$Data } from './types';
|
||||
|
||||
import chalk from 'chalk';
|
||||
|
||||
import formatDate from './format/formatDate';
|
||||
import isBn from './is/bn';
|
||||
import isBuffer from './is/buffer';
|
||||
@@ -23,13 +21,6 @@ const logTo = {
|
||||
warn: 'warn'
|
||||
};
|
||||
|
||||
const chalked = {
|
||||
debug: chalk.gray,
|
||||
error: chalk.red,
|
||||
log: chalk.reset,
|
||||
warn: chalk.yellow
|
||||
};
|
||||
|
||||
function formatObject (value: Record<string, unknown>): Record<string, unknown> {
|
||||
const result: Record<string, unknown> = {};
|
||||
|
||||
@@ -71,12 +62,9 @@ function apply (log: LogType, type: string, values: Logger$Data): void {
|
||||
return apply(log, type, Array.isArray(fnResult) ? fnResult : [fnResult]);
|
||||
}
|
||||
|
||||
const chalk = (value: string): string =>
|
||||
chalked[log](value);
|
||||
|
||||
console[logTo[log] as 'log'](
|
||||
chalk(formatDate(new Date())),
|
||||
chalk(type),
|
||||
formatDate(new Date()),
|
||||
type,
|
||||
...values.map(format)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user