-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: allow filter out values before merging them
by default, undefined is now filtered out. fix #460
- Loading branch information
1 parent
46e1c6d
commit bb3ad34
Showing
17 changed files
with
358 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { type DeepMergeBuiltInMetaData } from "../types"; | ||
|
||
/** | ||
* The default function to update meta data. | ||
* | ||
* It doesn't update the meta data. | ||
*/ | ||
export function defaultMetaDataUpdater<M>( | ||
previousMeta: M, | ||
metaMeta: DeepMergeBuiltInMetaData, | ||
): DeepMergeBuiltInMetaData { | ||
return metaMeta; | ||
} | ||
|
||
/** | ||
* The default function to filter values. | ||
* | ||
* It filters out undefined values. | ||
*/ | ||
export function defaultFilterValues<Ts extends ReadonlyArray<unknown>, M>( | ||
values: Ts, | ||
meta: M | undefined, | ||
): unknown[] { | ||
return values.filter((value) => value !== undefined); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.