Files
twenty/front/src/modules/spreadsheet-import/utils/uniqueEntries.ts
T
Ronit Panda 8639cb921e Chore: corrects syntax for type only imports (#1716)
* chore: removes replaces 'import type xxx from 'xxx'' with 'import { type xxx} from 'xxx'''

* chore: remove typed imports

* chore: remove typed imports

* chore: cleanup

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2023-09-26 11:47:35 +02:00

16 lines
414 B
TypeScript

import uniqBy from 'lodash/uniqBy';
import {
MatchColumnsProps,
MatchedOptions,
} from '@/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep';
export const uniqueEntries = <T extends string>(
data: MatchColumnsProps<T>['data'],
index: number,
): Partial<MatchedOptions<T>>[] =>
uniqBy(
data.map((row) => ({ entry: row[index] })),
'entry',
).filter(({ entry }) => !!entry);