Commit Graph

87 Commits

Author SHA1 Message Date
Samuel Berthe
124d3004de feat: adding FilterSliceToMap (#581) 2025-01-26 23:32:59 +01:00
Samuel Berthe
699707a0db feat(mutable): shuffle 2025-01-26 00:02:51 +01:00
Samuel Berthe
27d2554396 fix: renaming SliceToSet to Keyify 2025-01-25 23:26:53 +01:00
nicklausliu
b4412ea1af feat: add SliceToSet 2025-01-25 23:23:30 +01:00
Samuel Berthe
677bfd183b feat: deprecate lo.Reverse and move it to lom.Reverse (#576) 2025-01-25 18:26:52 +01:00
nicklaus-dev
c32746c703 feat: add UniqMap (#527) 2025-01-24 22:21:01 +01:00
Sianao Luo
1603a848b0 Update foreachwhile readme.md (#508)
* update readme.md for lo.ForEachWhile play and example code

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2024-08-10 01:25:12 +02:00
Sianao Luo
cbfd1c6286 add ForEachCondition implement (#485)
* add ForEachCondition implement

* add example and test code

* rename ForEachCondition() to ForEachWhile()

* update test and example code

* rename ExampleForForEachWhile() to ExampleForEachWhile()
2024-07-15 19:28:57 +02:00
Mihir Gandhi
9e343973a4 fix: chunk memory leak (#491) 2024-07-15 19:16:03 +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
Owen Gong
52e17faeec Added DropByIndex helper for slice (#398)
* added DropByIndex helper

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2024-06-30 00:38:34 +02:00
Samuel Berthe
3ba93a16cc feat: preserve type alias of slices and maps (see #365) 2024-06-30 00:04:08 +02:00
Felipe Gasper
de419c7571 Make Filter() preserve type. (#365)
* Update slice.go

* add test
2024-06-29 23:33:19 +02:00
Samuel Berthe
2ec43f41f4 Revert "Add new method Concat (#376)" (#479)
This reverts commit 940ded8b03.
2024-06-29 22:41:09 +02:00
Jason Zhang
940ded8b03 Add new method Concat (#376)
* Add new method Concat

---------

Co-authored-by: Zhang Jie (Jason) <jie.zhang@grabtaxi.com>
Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2024-06-29 21:53:58 +02:00
wick
fe16ff7d23 Add slice Splice an element or multiple elements at index i. (#371)
* Add slice Splice an element or multiple elements at index i.

* Update README.md

* Update slice.go

* Update slice.go

* Update README.md

* Update slice_test.go

---------

Co-authored-by: wenlingang <lingang.wen@longbridge.sg>
Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2024-06-29 20:25:42 +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
80bb7cefc6 feat: adding RejectMap (#473) 2024-06-27 16:17:40 +02:00
Samuel Berthe
91b5d9480e feat: adding FilterReject (#472) 2024-06-27 16:12:34 +02:00
Samuel Berthe
d1c7f3ae19 Update slice.go 2023-12-20 00:47:09 +01:00
Samuel Berthe
c1cc5a0a15 bump v1.38.0 2023-03-20 18:06:26 +01:00
Trim21
adcf8499eb perf: preallocate Filter,Compact result slice (#285)
* preallocate `Filter`, Compact result slice
2023-02-20 02:55:30 +01:00
Adam Szaraniec
17e921399f minor changes (#301) 2023-01-30 17:10:13 +01:00
Anatoly Rugalev
0ed7b6eb2a fix: set map capacity in Associate (#282) 2022-12-09 16:09:44 +01:00
Benn Huang
dba7426c43 fix (#256) 2022-11-15 20:36:05 +01:00
jiajie99
3206009698 docs: change wrong word 'round-robbin' to 'round-robin' (#249) 2022-10-16 13:39:31 +02: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
e3f7dab5ce doc: improve doc for lo.Interleave 2022-10-10 23:03:09 +02:00
dillonstreator
fd5527feb6 add Interleave helper to slices (#155)
* initial interleave working

* add nil case

* Update README.md

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2022-10-10 22:53:40 +02:00
Samuel Berthe
f44773e344 feat: adding CountValuesBy 2022-10-10 21:26:19 +02:00
orccn
5f3a5c0f60 Add CountValues function (#200)
* Flatten: named return parameters

* Add CountValues function

* fix S1036: unnecessary guard around map access

* update README.md

Co-authored-by: 刘鹏宇 <liupengyu@showmac.com>
2022-10-10 20:59:41 +02:00
Samuel Berthe
cc3aa2287b doc(examples): adding go playground examples (string, map, slice, condition, math) 2022-10-03 22:17:15 +02:00
Samuel Berthe
4fecc9049c doc: adding examples (#230) 2022-10-03 19:19:15 +02:00
Trim21
459062d4ad Slice can take any slice (#207) 2022-09-15 10:28:09 +02:00
y.okamoto
c3c78528e5 fix: typo on comment of SliceToMap function (#213) 2022-09-15 10:21:40 +02:00
Sergei Makarov
bfae21c5e3 Fix: up to 80% speed and memory optimizations for slices (#215)
* slice optimizations
2022-09-15 10:18:54 +02:00
Samuel Berthe
a4816ee5ff adding alias lo.SliceToMap -> lo.Associate 2022-07-29 11:59:00 +02:00
Samuel Berthe
136691e8f3 oops 2022-07-24 23:20:29 +02:00
Samuel Berthe
7a82347b1b doc: adding IsSorted and IsSortedByKey 2022-07-24 22:57:58 +02:00
fffzlfk
add5ee4bb2 feat: add issorted (#152) 2022-07-24 22:47:12 +02:00
Samuel Berthe
03b4947e91 reorder things 2022-07-24 22:29:10 +02:00
Samuel Berthe
af87abb7b0 improves doc for lo.ReduceRight 2022-07-24 19:25:05 +02:00
xhdnoah
c6e4913100 Add ReduceRight (#178)
Co-authored-by: xuhaidong_dxm <xuhaidong01@duxiaoman.com>
2022-07-24 19:20:35 +02:00
elvis
20debbb39e add Associate function (#185) 2022-07-24 19:15:07 +02:00
Samuel Berthe
0d64a89dcf Merge branch 'master' of github.com:samber/lo 2022-07-03 22:23:36 +02:00
Samuel Berthe
9d6cf65dd8 doc 2022-07-03 22:23:27 +02:00
orccn
833e68a572 Flatten: named return parameters (#158) 2022-07-03 22:14:30 +02:00
Syuparn
252d72a238 feat: adding Compact (#154)
Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2022-07-03 21:30:17 +02:00
Samuel Berthe
36276f8cdd doc: clarify Subset vs Slice 2022-07-03 19:13:35 +02:00