8639cb921e
* 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>
16 lines
414 B
TypeScript
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);
|