Edvard
87553560d4
feat: Add NthOr and NthOrEmpty functions ( #611 )
...
* feat: Add NthOr and NthOrEmpty functions
This commit introduces two new functions, `NthOr` and `NthOrEmpty`, to the `find` package. These functions provide a safer way to access elements at a specific index in a slice, handling out-of-bounds scenarios gracefully.
- `NthOr`: Returns the element at the specified index or a provided fallback value if the index is out of bounds.
- `NthOrEmpty`: Returns the element at the specified index or the zero value for the slice's element type if the index is out of bounds.
* update readme
2025-03-17 00:13:20 +01:00
Bram Van de Walle
86ce870075
feat: add SampleBy and SamplesBy ( #516 )
...
* Add SampleBy and SamplesBy
Co-authored-by: Bram Van de Walle <bram.vandewalle@otainsight.com >
Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr >
2025-01-26 15:57:04 +01:00
Aria
a6a6a82ad4
feat: add (Min|Max)Index(By) ( #569 )
2025-01-24 14:58:01 +01:00
Timur Polukeev
34537d5291
feat: adding EarliestBy and LatestBy functions ( #489 )
2024-07-13 16:41:15 +02:00
Samuel Berthe
3ba93a16cc
feat: preserve type alias of slices and maps (see #365 )
2024-06-30 00:04:08 +02:00
Samuel Berthe
5aa64ef280
feat: adding LastOrEmpty and LastOr ( #474 )
2024-06-28 00:46:42 +02:00
Alireza Kiani
a94098f9b0
Add First and FirstOrZeroValue functions ( #451 )
...
* feat: add first and firstOrZeroValue functions
* doc: update readme for First and FirstOrZeroValue functions
* feat: follow convention for return items and reuse base First function and add FirstOr
* doc: update documentation for First methods
2024-06-28 00:39:16 +02:00
Samuel Berthe
c23c040774
feat: adding Earliest and Latest ( #468 )
2024-06-27 15:42:18 +02:00
Samuel Berthe
92db86fea1
more tests
2024-06-27 15:13:04 +02:00
Samuel Berthe
417e49028e
Adding FindOrElse to doc
2023-02-20 01:21:46 +01:00
Anandraj Elumalai
27d881052b
fix: resolved code smells ( #258 )
...
Made the project to smell good
Co-authored-by: aelumalai <aelumalai@paypal.com >
2022-10-31 15:48:04 +01:00
Samuel Berthe
31f3bc3a85
test: parallel tests everywhere ( #228 )
2022-10-02 21:38:26 +02:00
Corentin Clabaut
dcaaeb0f65
Add Duplicate & DuplicateBy ( #122 )
...
* Add FindDuplicates & FindDuplicatesBy & FindUniques & FindUniquesBy
Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr >
2022-07-05 00:46:24 +02:00
Samuel Berthe
5bdd1c13c9
feat: adding FindKey and FindKeyBy
2022-07-04 00:57:53 +02:00
Scott Crunkleton
c77a9c03e7
Nth: Fix bug for -1 index on slice of len 1. Simplified/more performant out of bounds checking. ( #137 )
2022-07-03 22:20:35 +02:00
lu4p
305f565368
remove unnecessary explicit typeparams ( #134 )
2022-05-11 13:10:36 +02:00
Samuel Berthe
dff318b485
doc(coalesce): adding doc for this new helper
2022-04-21 17:19:25 +02:00
wirekang
b803f8aa23
Add #96
2022-04-20 22:25:22 +09:00
Ferdinand Mütsch
ea450284be
feat: implement findorelse function ( resolve #52 )
2022-04-11 22:10:57 +02:00
Samuel Berthe
78aa4b0940
Merge branch 'master' into minmaxby
2022-04-11 20:36:16 +02:00
Samuel Berthe
5faec93789
feat(find): adding FindLastIndexOf + doc
2022-04-11 20:10:27 +02:00
Albert Salim
b967afe9a7
Implement FindIndex
...
FindIndex searches an element in a slice based on a predicate and returns the index and true.
It returns -1 and false if the element is not found.
#61
2022-04-11 13:55:40 +08:00
CorentinClabaut
cc71adbe19
Implements MinBy and MaxBy
...
closes #71
2022-03-24 08:54:41 +01:00
Samuel Berthe
98ecdea940
adding Sample+Samples
2022-03-05 23:13:18 +01:00
Samuel Berthe
d90b8528ad
fix Nth
2022-03-05 20:14:04 +01:00
Samuel Berthe
a59137782c
Last and Nth return errors
2022-03-03 18:10:32 +01:00
Samuel Berthe
74b7c77702
Initial commit
2022-03-02 13:52:01 +01:00