-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add more object utils test + remove undefined value when use wi…
…th invertKeysAndValues fnc (#4764) ### Description Add filter `undefined/null` value when use with utils **invertKeysAndValues** function Add more test at `objects.test.ts` <!-- What's included in this PR? --> ### Drive-by changes ```diff return Object.fromEntries( Object.entries(data) + .filter(([_, value]) => value !== undefined && value !== null) // Filter out undefined and null values .map(([key, value]) => [value, key]), ); ``` <!-- Are there any minor or drive-by changes also included? --> ### Related issues None <!-- - Fixes #[issue number here] --> ### Backward compatibility Currently, nowhere call this **invertKeysAndValues** func <!-- Are these changes backward compatible? Are there any infrastructure implications, e.g. changes that would prohibit deploying older commits using this infra tooling? Yes/No --> ### Testing Yes, more tests. <!-- What kind of testing have these changes undergone? None/Manual/Unit Tests --> --------- Co-authored-by: J M Rossy <jm.rossy@gmail.com>
- Loading branch information
Showing
3 changed files
with
138 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@hyperlane-xyz/utils": patch | ||
--- | ||
|
||
Filter undefined/null values in invertKeysAndValues function |
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