Skip to content

Commit

Permalink
Change function name
Browse files Browse the repository at this point in the history
  • Loading branch information
MilapNaik committed Feb 6, 2024
1 parent f15f295 commit 096d23a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ',
Expand All @@ -322,7 +322,7 @@ describe('util', () => {
'serial-number': null
};

const result = util.printObjectToTable(deviceInfo);
const result = util.objectToTableString(deviceInfo);

const expectedOutput = [
'Name Value ',
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export class Util {
});
}

public printObjectToTable(deviceInfo: Record<string, any>) {
public objectToTableString(deviceInfo: Record<string, any>) {
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;
Expand Down

0 comments on commit 096d23a

Please sign in to comment.