Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const saveCount = this.encoder.count();
const saveSize = this.encoder.size();
this.encode(obj, i);
const count = this.encoder.count() - saveCount;
const size = this.encoder.size() - saveSize;
totalCount += count;
totalSize += size;
if (this.verbose) {
console.warn(` ${leftPad(i.identifier, 20)} ` +
`${leftPad(count, PADDING)} fields ${leftPad(size, PADDING)} chars`);
}
}
if (this.verbose) {
console.warn(' -------------------- -------------- --------------');
console.warn(` ${leftPad('Total', 20)} ` +
`${leftPad(totalCount, PADDING)} fields ${leftPad(totalSize, PADDING)} chars`);
console.warn(` ${leftPad('', 20)} ${leftPad(this.encoder.distinct(), PADDING)} distinct strings`);
}
}
const saveSize = this.encoder.size();
this.encode(obj, i);
const count = this.encoder.count() - saveCount;
const size = this.encoder.size() - saveSize;
totalCount += count;
totalSize += size;
if (this.verbose) {
console.warn(` ${leftPad(i.identifier, 20)} ` +
`${leftPad(count, PADDING)} fields ${leftPad(size, PADDING)} chars`);
}
}
if (this.verbose) {
console.warn(' -------------------- -------------- --------------');
console.warn(` ${leftPad('Total', 20)} ` +
`${leftPad(totalCount, PADDING)} fields ${leftPad(totalSize, PADDING)} chars`);
console.warn(` ${leftPad('', 20)} ${leftPad(this.encoder.distinct(), PADDING)} distinct strings`);
}
}
private encodeOrigin(obj: any, inst: Origin): void {
this.origin = inst;
let totalCount = 0;
let totalSize = 0;
for (const i of inst.block) {
const saveCount = this.encoder.count();
const saveSize = this.encoder.size();
this.encode(obj, i);
const count = this.encoder.count() - saveCount;
const size = this.encoder.size() - saveSize;
totalCount += count;
totalSize += size;
if (this.verbose) {
console.warn(` ${leftPad(i.identifier, 20)} ` +
`${leftPad(count, PADDING)} fields ${leftPad(size, PADDING)} chars`);
}
}
if (this.verbose) {
console.warn(' -------------------- -------------- --------------');
console.warn(` ${leftPad('Total', 20)} ` +
`${leftPad(totalCount, PADDING)} fields ${leftPad(totalSize, PADDING)} chars`);
console.warn(` ${leftPad('', 20)} ${leftPad(this.encoder.distinct(), PADDING)} distinct strings`);
}
}
private encodeOrigin(obj: any, inst: Origin): void {
this.origin = inst;
let totalCount = 0;
let totalSize = 0;
for (const i of inst.block) {
const saveCount = this.encoder.count();
const saveSize = this.encoder.size();
this.encode(obj, i);
const count = this.encoder.count() - saveCount;
const size = this.encoder.size() - saveSize;
totalCount += count;
totalSize += size;
if (this.verbose) {
console.warn(` ${leftPad(i.identifier, 20)} ` +
`${leftPad(count, PADDING)} fields ${leftPad(size, PADDING)} chars`);
}
}
if (this.verbose) {
console.warn(' -------------------- -------------- --------------');
console.warn(` ${leftPad('Total', 20)} ` +
`${leftPad(totalCount, PADDING)} fields ${leftPad(totalSize, PADDING)} chars`);
console.warn(` ${leftPad('', 20)} ${leftPad(this.encoder.distinct(), PADDING)} distinct strings`);
}
}