Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
abrantesarthur committed Jan 14, 2025
1 parent 029680b commit c05884b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
20 changes: 10 additions & 10 deletions src/tests/transposeObjectArray.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { transposeObjectArray } from '../transposeObjectArray';

describe('transposeObjectArray', () => {
it('should handle empty array', () => {
const result = transposeObjectArray({objects: [], properties: ['id', 'name']});
const result = transposeObjectArray({ objects: [], properties: ['id', 'name'] });
expect(result).to.deep.equal({});
});

Expand All @@ -12,7 +12,7 @@ describe('transposeObjectArray', () => {
{ id: 1, name: 'John', age: 25, city: 'NY' },
{ id: 2, name: 'Jane', age: 30, city: 'LA' },
];
const result = transposeObjectArray({objects, properties: ['id', 'name']});
const result = transposeObjectArray({ objects, properties: ['id', 'name'] });
expect(result).to.deep.equal({
id: [1, 2],
name: ['John', 'Jane'],
Expand All @@ -29,7 +29,7 @@ describe('transposeObjectArray', () => {
{ id: 2, age: 30 },
{ id: 3, name: 'Bob', city: 'LA' },
];
const result = transposeObjectArray({objects, properties: ['id', 'name']});
const result = transposeObjectArray({ objects, properties: ['id', 'name'] });
expect(result).to.deep.equal({
id: [1, 2, 3],
name: ['John', undefined, 'Bob'],
Expand All @@ -42,7 +42,7 @@ describe('transposeObjectArray', () => {
{ id: 1, active: true, count: 10, tags: ['a', 'b'] },
{ id: 2, active: false, count: 20, tags: ['c'] },
];
const result = transposeObjectArray({objects, properties: ['active', 'tags']});
const result = transposeObjectArray({ objects, properties: ['active', 'tags'] });
expect(result).to.deep.equal({
active: [true, false],
tags: [['a', 'b'], ['c']],
Expand All @@ -58,7 +58,7 @@ describe('transposeObjectArray', () => {
{ id: 1, name: 'John' },
{ id: 2, name: 'Jane' },
];
const result = transposeObjectArray({objects, properties: ['id', 'name']});
const result = transposeObjectArray({ objects, properties: ['id', 'name'] });
expect(result).to.deep.equal({
id: [1, 2],
name: ['John', 'Jane'],
Expand All @@ -71,7 +71,7 @@ describe('transposeObjectArray', () => {
{ id: 1, name: 'John' },
{ id: 2, name: 'Jane' },
];
const result = transposeObjectArray({objects, properties: []});
const result = transposeObjectArray({ objects, properties: [] });
expect(result).to.deep.equal({
rest: [
{ id: 1, name: 'John' },
Expand All @@ -85,7 +85,7 @@ describe('transposeObjectArray', () => {
{ id: 1, name: null, age: 25 },
{ id: 2, name: undefined, age: 30 },
];
const result = transposeObjectArray({objects, properties: ['id', 'name']});
const result = transposeObjectArray({ objects, properties: ['id', 'name'] });
expect(result).to.deep.equal({
id: [1, 2],
name: [null, undefined],
Expand All @@ -98,7 +98,7 @@ describe('transposeObjectArray', () => {
{ id: 1, user: { name: 'John', age: 25 } },
{ id: 2, user: { name: 'Jane', age: 30 } },
];
const result = transposeObjectArray({objects, properties: ['id', 'user']});
const result = transposeObjectArray({ objects, properties: ['id', 'user'] });
expect(result).to.deep.equal({
id: [1, 2],
user: [
Expand All @@ -114,7 +114,7 @@ describe('transposeObjectArray', () => {
{ a: 1, b: 2, c: 3, d: 4 },
{ a: 5, b: 6, c: 7, d: 8 },
];
const result = transposeObjectArray({objects, properties: ['a', 'c']});
const result = transposeObjectArray({ objects, properties: ['a', 'c'] });
expect(result).to.deep.equal({
a: [1, 5],
c: [3, 7],
Expand All @@ -130,7 +130,7 @@ describe('transposeObjectArray', () => {
{ id: 1, name: null, age: 25 },
{ id: 2, name: undefined, age: 30 },
];
const result = transposeObjectArray({objects, properties: ['id', 'name'], options: {includeOtherProperties: false}});
const result = transposeObjectArray({ objects, properties: ['id', 'name'], options: { includeOtherProperties: false } });
expect(result).to.deep.equal({
id: [1, 2],
name: [null, undefined],
Expand Down
3 changes: 1 addition & 2 deletions src/transposeObjectArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ export const transposeObjectArray = <T extends object, K extends keyof T>(
}
});

if(options.includeOtherProperties) {

if (options.includeOtherProperties) {
result.rest = [...(acc.rest || []), restObject];
}

Expand Down

0 comments on commit c05884b

Please sign in to comment.