@chainsafe/lodestar-utils
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -0,1 +1,2 @@ | ||
export * from "./assert"; | ||
export * from "./math"; | ||
@@ -2,0 +3,0 @@ export * from "./bytes"; |
@@ -7,2 +7,14 @@ "use strict"; | ||
var _assert = require("./assert"); | ||
Object.keys(_assert).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _assert[key]; | ||
} | ||
}); | ||
}); | ||
var _math = require("./math"); | ||
@@ -9,0 +21,0 @@ |
@@ -28,5 +28,6 @@ "use strict"; | ||
if (context instanceof Error) { | ||
return context.stack; | ||
return "Error: " + context.message + "\n" + context.stack; | ||
} | ||
if (typeof context === "string") return context; | ||
return Object.keys(context).map(key => { | ||
@@ -33,0 +34,0 @@ let value = ""; |
/** | ||
* @module logger | ||
*/ | ||
/// <reference types="node" /> | ||
import { ArrayLike } from "@chainsafe/ssz"; | ||
import { Writable } from "stream"; | ||
export declare enum LogLevel { | ||
@@ -24,4 +26,4 @@ error = "error", | ||
export interface ILoggerOptions { | ||
level: LogLevel; | ||
module: string; | ||
level?: LogLevel; | ||
module?: string; | ||
} | ||
@@ -45,3 +47,4 @@ export declare type Context = { | ||
}): void; | ||
stream(): Writable; | ||
child(options: ILoggerOptions): ILogger; | ||
} |
/** | ||
* @module logger | ||
*/ | ||
/// <reference types="node" /> | ||
import { Context, ILogger, ILoggerOptions, LogLevel } from "./interface"; | ||
import TransportStream from "winston-transport"; | ||
import { Writable } from "stream"; | ||
export declare class WinstonLogger implements ILogger { | ||
@@ -22,2 +24,3 @@ private winston; | ||
}): void; | ||
stream(): Writable; | ||
set level(level: LogLevel); | ||
@@ -24,0 +27,0 @@ get level(): LogLevel; |
@@ -44,2 +44,4 @@ "use strict"; | ||
transports: transports || [new _winston.transports.Console({ | ||
debugStdout: true, | ||
level: "silly", | ||
handleExceptions: true | ||
@@ -89,2 +91,6 @@ })], | ||
stream() { | ||
return null; | ||
} | ||
set level(level) { | ||
@@ -122,7 +128,7 @@ this.winston.level = _interface.LogLevel[level]; | ||
createLogEntry(level, message, context) { | ||
if (this.silent || this.winston.levels[level] > this.winston.levels[this.winston.level]) { | ||
if (this.silent || this.winston.levels[level] > this.winston.levels[this._level]) { | ||
return; | ||
} | ||
this.winston.log(level, message, { | ||
this.winston[level](message, { | ||
context | ||
@@ -129,0 +135,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
export declare function objectToCamelCase(obj: object): object; | ||
export declare function objectToExpectedCase(obj: Record<string, unknown>, expectedCase?: "snake" | "camel"): object; |
@@ -6,32 +6,25 @@ "use strict"; | ||
}); | ||
exports.objectToCamelCase = objectToCamelCase; | ||
exports.objectToExpectedCase = objectToExpectedCase; | ||
var _camelcase = _interopRequireDefault(require("camelcase")); | ||
var _utils = require("@chainsafe/ssz/lib/backings/utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// eslint-disable-next-line import/default | ||
function objectToCamelCase(obj) { | ||
function objectToExpectedCase(obj, expectedCase = "camel") { | ||
if (Object(obj) === obj) { | ||
Object.getOwnPropertyNames(obj).forEach(name => { | ||
const newName = (0, _camelcase.default)(name); | ||
const newName = (0, _utils.toExpectedCase)(name, expectedCase); | ||
if (newName !== name) { | ||
// @ts-ignore | ||
if (obj.hasOwnProperty(newName)) { | ||
throw new Error("object already has a ".concat(newName, " property")); | ||
} // @ts-ignore | ||
} | ||
obj[newName] = obj[name]; // @ts-ignore | ||
obj[newName] = obj[name]; | ||
delete obj[name]; | ||
} // @ts-ignore | ||
} | ||
objectToCamelCase(obj[newName]); | ||
objectToExpectedCase(obj[newName], expectedCase); | ||
}); | ||
} else if (Array.isArray(obj)) { | ||
for (let i = 0; i < obj.length; i++) { | ||
obj[i] = objectToCamelCase(obj[i]); | ||
obj[i] = objectToExpectedCase(obj[i], expectedCase); | ||
} | ||
@@ -38,0 +31,0 @@ } |
@@ -16,3 +16,3 @@ "use strict"; | ||
function loadYaml(yaml) { | ||
return (0, _misc.objectToCamelCase)((0, _jsYaml.load)(yaml, { | ||
return (0, _misc.objectToExpectedCase)((0, _jsYaml.load)(yaml, { | ||
schema: _schema.schema | ||
@@ -19,0 +19,0 @@ })); |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"main": "lib/index.js", | ||
@@ -26,4 +26,6 @@ "files": [ | ||
"build:lib": "babel src -x .ts -d lib --source-maps", | ||
"build:lib:watch": "yarn run build:lib --watch", | ||
"build:release": "yarn clean && yarn build && yarn build:docs", | ||
"build:types": "tsc --incremental --project tsconfig.build.json --declaration --outDir lib --emitDeclarationOnly", | ||
"build:types:watch": "yarn run build:types --watch --preserveWatchOutput", | ||
"check-types": "tsc --noEmit", | ||
@@ -39,3 +41,3 @@ "clean": "rm -rf lib && rm -f tsconfig.tsbuildinfo", | ||
"dependencies": { | ||
"@chainsafe/ssz": "^0.6.5", | ||
"@chainsafe/ssz": "^0.6.9", | ||
"bigint-buffer": "^1.1.5", | ||
@@ -63,3 +65,3 @@ "camelcase": "^5.3.1", | ||
], | ||
"gitHead": "a7b4c5ad002f018f0682a627b7c528d5743f6647" | ||
"gitHead": "3f4c0201b01e4526703f157f5b882795287f85c8" | ||
} |
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
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
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
85901
54
0
100
998
0
3
Updated@chainsafe/ssz@^0.6.9