Samuel Berthe
9a35a6198f
style(lint): revive
2025-09-20 01:22:52 +02:00
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
Nathan Baulch
db0f4d2171
Tidy up ( #519 )
2024-08-22 01:17:02 +02:00
Timur Polukeev
34537d5291
feat: adding EarliestBy and LatestBy functions ( #489 )
2024-07-13 16:41:15 +02:00
Samuel Berthe
3b29b7d918
feat: upgrade to math/rand/v2 ( #483 )
...
* feat: upgrade to math/rand/v2
* lint: silent warning
2024-06-30 03:54:55 +02:00
Samuel Berthe
3ba93a16cc
feat: preserve type alias of slices and maps (see #365 )
2024-06-30 00:04:08 +02:00
Trim21
42a90a0c7b
remove golang.org/x/exp
since it doesn't follow go 1 compatibility promise ( #478 )
...
* fix
* mod tidy
* remove test
* redirect cmp.Ordered
* fix
* fix
* fix
2024-06-29 18:03:44 +02:00
Samuel Berthe
61209816d1
feat: speed up loops by reducing allocations ( #475 )
2024-06-28 01:35:57 +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
0efce40cf0
lint
2024-06-27 21:05:31 +02:00
Samuel Berthe
c23c040774
feat: adding Earliest and Latest ( #468 )
2024-06-27 15:42:18 +02:00
Mohit Vachhani
c729db34d0
fix: samples, cOpy -> copy ( #279 )
...
Co-authored-by: Mohit Vachhani <mohitvachhani@Mohits-MacBook-Pro-2.local >
2022-12-02 17:38:35 +01:00
Samuel Berthe
7887963db8
feat: name each callback/iteratee/predicate arguments in order to improve autocompletion
...
closes #242
2022-10-13 22:25:33 +02:00
Samuel Berthe
330382f7bd
doc: improve doc
2022-10-10 22:16:38 +02:00
Alex Efros
b8909542a9
feat: relax FindKeyBy constraint ( #205 )
2022-08-29 00:10:36 +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
Scott Crunkleton
1a0b4e62a6
Nth: use constraints.Integer for nth param. ( #151 )
...
* Nth: use constraints.Integer for nth param
* Tab instead of spaces
2022-07-05 00:35:10 +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
Samuel Berthe
e0853ca970
feat: Add FromAnySlice ( #133 )
...
* feat: adding FromAnySlice helper
2022-05-10 15:43:34 +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
be023ef06e
Merge pull request #87 from xiaosongfu/fix-func-comment
...
fix func comment warning
2022-04-11 20:32:15 +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
xiaosongfu
0c64f2c093
fix func comment warning
2022-04-08 19:19:57 +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
a10aa3e37d
Merge branch 'master' of github.com:samber/lo
2022-03-04 00:20:59 +01:00
Samuel Berthe
0a9b6718e7
replace custom constraint by stdlib
2022-03-04 00:20:45 +01:00
Sergio Moura
9d1979e334
Less instructions on min and max
2022-03-03 14:20:55 -05:00
Samuel Berthe
4e339add08
Last and Nth return errors
2022-03-03 18:12:22 +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