From 096d23aa49c6314aa887c0f54da232ecd4dee375 Mon Sep 17 00:00:00 2001 From: Milap Naik Date: Tue, 6 Feb 2024 15:34:00 -0500 Subject: [PATCH] Change function name --- src/util.spec.ts | 6 +++--- src/util.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util.spec.ts b/src/util.spec.ts index fd3d353..f58c18c 100644 --- a/src/util.spec.ts +++ b/src/util.spec.ts @@ -297,14 +297,14 @@ describe('util', () => { }); }); - describe('printObjectToTable', () => { + describe('objectToTableString', () => { it('should print an object to a table', () => { const deviceInfo = { 'device-id': '1234', 'serial-number': 'abcd' }; - const result = util.printObjectToTable(deviceInfo); + const result = util.objectToTableString(deviceInfo); const expectedOutput = [ 'Name Value ', @@ -322,7 +322,7 @@ describe('util', () => { 'serial-number': null }; - const result = util.printObjectToTable(deviceInfo); + const result = util.objectToTableString(deviceInfo); const expectedOutput = [ 'Name Value ', diff --git a/src/util.ts b/src/util.ts index c275c88..ca7d7d4 100644 --- a/src/util.ts +++ b/src/util.ts @@ -225,7 +225,7 @@ export class Util { }); } - public printObjectToTable(deviceInfo: Record) { + public objectToTableString(deviceInfo: Record) { const margin = 5; const keyWidth = Math.max(...Object.keys(deviceInfo).map(x => x.length)) + margin; const valueWidth = Math.max(...Object.values(deviceInfo).map(x => (x ?? '').toString().length)) + margin;