Renamed nullable utils into isDefined and isUndefinedOrNull (#4402)

* Renamed nullable utils into isDefined and isUndefinedOrNull
This commit is contained in:
Lucas Bordeau
2024-03-11 14:28:57 +01:00
committed by GitHub
parent 3f15cc5b7a
commit 581dfafe11
169 changed files with 469 additions and 493 deletions

View File

@ -6,7 +6,7 @@ import {
MatchColumnsStepProps,
} from '@/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep';
import { Field, Fields } from '@/spreadsheet-import/types';
import { isNonNullable } from '~/utils/isNonNullable';
import { isDefined } from '~/utils/isDefined';
import { findMatch } from './findMatch';
import { setColumn } from './setColumn';
@ -19,7 +19,7 @@ export const getMatchedColumns = <T extends string>(
) =>
columns.reduce<Column<T>[]>((arr, column) => {
const autoMatch = findMatch(column.header, fields, autoMapDistance);
if (isNonNullable(autoMatch)) {
if (isDefined(autoMatch)) {
const field = fields.find((field) => field.key === autoMatch) as Field<T>;
const duplicateIndex = arr.findIndex(
(column) => 'value' in column && column.value === field.key,