Skip to content

Commit 9d56491

Browse files
typescript format
1 parent 801b51d commit 9d56491

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

crates/js/lib/src/integrations/permutive/segments.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ export function getPermutiveSegments(): string[] {
2727
const all = data?.core?.cohorts?.all;
2828
if (Array.isArray(all) && all.length > 0) {
2929
log.debug('getPermutiveSegments: found segments in core.cohorts.all', { count: all.length });
30-
return all
31-
.filter((s: unknown) => typeof s === 'string' || typeof s === 'number')
32-
.map(String);
30+
return all.filter((s: unknown) => typeof s === 'string' || typeof s === 'number').map(String);
3331
}
3432

3533
// Fallback: eventUpload entries (transient event data)

crates/js/lib/test/integrations/permutive/segments.test.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('getPermutiveSegments', () => {
2828
'permutive-app',
2929
JSON.stringify({
3030
core: { cohorts: { all: ['10000001', '10000003', 'adv', 'bhgp'] } },
31-
}),
31+
})
3232
);
3333
expect(getPermutiveSegments()).toEqual(['10000001', '10000003', 'adv', 'bhgp']);
3434
});
@@ -38,7 +38,7 @@ describe('getPermutiveSegments', () => {
3838
'permutive-app',
3939
JSON.stringify({
4040
core: { cohorts: { all: [123, 456] } },
41-
}),
41+
})
4242
);
4343
expect(getPermutiveSegments()).toEqual(['123', '456']);
4444
});
@@ -48,11 +48,9 @@ describe('getPermutiveSegments', () => {
4848
'permutive-app',
4949
JSON.stringify({
5050
eventPublication: {
51-
eventUpload: [
52-
['key1', { event: { properties: { segments: ['seg1', 'seg2'] } } }],
53-
],
51+
eventUpload: [['key1', { event: { properties: { segments: ['seg1', 'seg2'] } } }]],
5452
},
55-
}),
53+
})
5654
);
5755
expect(getPermutiveSegments()).toEqual(['seg1', 'seg2']);
5856
});
@@ -67,7 +65,7 @@ describe('getPermutiveSegments', () => {
6765
['new', { event: { properties: { segments: ['new1', 'new2'] } } }],
6866
],
6967
},
70-
}),
68+
})
7169
);
7270
// Should return the last (most recent) entry
7371
expect(getPermutiveSegments()).toEqual(['new1', 'new2']);
@@ -78,7 +76,7 @@ describe('getPermutiveSegments', () => {
7876
'permutive-app',
7977
JSON.stringify({
8078
core: { cohorts: { all: [] } },
81-
}),
79+
})
8280
);
8381
expect(getPermutiveSegments()).toEqual([]);
8482
});
@@ -88,7 +86,7 @@ describe('getPermutiveSegments', () => {
8886
'permutive-app',
8987
JSON.stringify({
9088
core: { cohorts: { all: ['valid', 123, null, undefined, true, { obj: 1 }] } },
91-
}),
89+
})
9290
);
9391
expect(getPermutiveSegments()).toEqual(['valid', '123']);
9492
});

0 commit comments

Comments
 (0)