Commit Graph

613 Commits

Author SHA1 Message Date
mengxun
b1a108d0d3 docs: Fix the Markdown syntax that is not displaying correctly (#658) 2025-08-12 16:51:21 +02:00
ghosx
bededfed30 feature: add Mode function with tests and documentation (#644)
* Update README.md

Fixed the error in the usage example of lo.Latest in readme.md

use []time.Time{…} (value of type []time.Time) as time.Time value in argument to lo.Latest

* Update README.md

* feature: add Mode function with tests and documentation

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-07-07 02:05:39 +02:00
Samuel Berthe
c66dc5432a fix: fix randomly failing test 2025-07-07 02:03:06 +02:00
Samuel Berthe
0906f969ae fix(retry): fix potential race condition in debounce callback (#650)
* fix(retry): fix potential race condition in debounce callback

* fix previous commit: make it compatible with old go version
2025-07-06 18:17:27 +02:00
Samuel Berthe
68d57fe402 fix(zipx): fix the max length calculation (#649) 2025-07-06 17:28:27 +02:00
Samuel Berthe
f8024de2ce fix(chunk): Copy chunk in a new slice (#648)
Prevents memory leak and free memory from initial collection.
2025-07-06 15:33:18 +02:00
Mark Hildreth
82f753a511 Fix Product and ProductBy documentation (#647)
These functions stated that if empty they return 0, but in actuality the code returns 1
2025-07-02 17:28:50 +02:00
Samuel Berthe
49f24de919 style: merge assertion.go and errors.go 2025-06-01 16:19:29 +02:00
ynn
e9281d8a66 feat(assertions): add Assert and Assertf (#638)
Co-authored-by: ynn <contact@your-diary.io>
2025-06-01 16:12:44 +02:00
Ali Sunjaya
2b57de74f4 docs: fix wrong variable name for mutable map example (#637) 2025-05-27 11:11:51 +02:00
Emil Shakirov
f2cfb22748 docs: Fix description for LastOrEmpty and LastOr (#636) 2025-05-22 13:13:51 +02:00
Samuel Berthe
52ad90c405 doc: Improve comment for lo.Ellipsis 2025-05-22 13:13:05 +02:00
mengxun
f1dce8f5e7 docs: Add a more precise description to the Ellipsis function to prevent misunderstanding. (#635)
Signed-off-by: mengxun <mengxun1122@163.com>
2025-05-22 13:12:10 +02:00
d-enk
a9a589c4d5 fix(ci): correct cleanup deps - remove all *_test.go files using find (#630) 2025-05-05 21:09:38 +02:00
dependabot[bot]
975e837466 chore(deps): bump golangci/golangci-lint-action from 7 to 8 (#628)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 7 to 8.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v7...v8)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-05 15:15:36 +02:00
ghosx
3a534ad9b4 Fixed the error in the usage example of lo.Latest in readme.md (#627)
* Update README.md

Fixed the error in the usage example of lo.Latest in readme.md

use []time.Time{…} (value of type []time.Time) as time.Time value in argument to lo.Latest

* Update README.md

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-05-03 22:22:59 +02:00
Samuel Berthe
e62450f888 Revert "chore(deps): bump golang.org/x/text from 0.22.0 to 0.24.0 (#625)" (#626)
This reverts commit a743f2a685.
2025-04-28 15:28:54 +02:00
dependabot[bot]
a743f2a685 chore(deps): bump golang.org/x/text from 0.22.0 to 0.24.0 (#625)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.22.0 to 0.24.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.22.0...v0.24.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-version: 0.24.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-28 15:14:44 +02:00
Samuel Berthe
7f3c0b84fd Update README.md 2025-04-26 19:43:12 +02:00
Samuel Berthe
4fdf4d1fe2 Update README.md 2025-04-26 19:35:20 +02:00
Oganes Mirzoyan
4a43ff68b4 Add ElementsMatch, ElementsMatchBy (#589)
* Add ElementsMatch, ElementsMatchBy

* Update intersect.go

* Update README.md

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-04-26 19:06:51 +02:00
Samuel Berthe
0bc568abfc Update README.md 2025-04-26 19:03:52 +02:00
Samuel Berthe
c7a67cad51 feat(mutable): adding Map, MapI, Filter, FilterI (#577)
* feat(mutable): adding Map, MapI, Filter, FilterI

* Update README.md

* doc: add doc and examples for lom.Filter

* oops
2025-04-26 18:54:36 +02:00
Samuel Berthe
e5dba6f459 feat: adding FilterMapToSlice (#623) 2025-04-26 18:13:17 +02:00
Oswaldo Montaño
e343af088f docs: add play link for ChunkEntries example in README (#600)
* docs: add play link for ChunkEntries example in README

* Update map.go

---------

Co-authored-by: Oswaldo Montaño <oswaldo.montano.ext@diagroup.com>
Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-04-26 17:46:02 +02:00
Artem Mikheev
38f67506fe optimization: preallocate result in FilterMap (#622)
Co-authored-by: Artem Mikheev <renbou@pinely.com>
2025-04-26 17:34:10 +02:00
Samuel Berthe
d91b19f1eb chore: lint 💄 2025-04-26 17:33:43 +02:00
Samuel Berthe
964a3c7ac3 chore(ci): test more go version 2025-04-24 00:52:33 +02:00
Samuel Berthe
0f7f47e338 fix: fix backward compatibility to go 1.18 2025-04-24 00:46:03 +02:00
Ahmed Ashraf
2bc3746616 fix typo in readme (#620) 2025-04-13 00:19:30 +02:00
dependabot[bot]
3f3aab7a26 chore(deps): bump golang.org/x/text from 0.22.0 to 0.24.0 (#618)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.22.0 to 0.24.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.22.0...v0.24.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-version: 0.24.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-09 02:04:07 +02:00
dependabot[bot]
3ce2b6f9c9 chore(deps): bump golangci/golangci-lint-action from 6 to 7 (#616)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v6...v7)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-02 23:27:09 +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
peterhoward42
17d82f463d fix: Issue 605 (README for Ternary() (#606)
* fix: Issue 605

* Add the Ternary comment from prev commit to function docstring
2025-03-04 21:25:46 +01:00
Jialei
b828ea137f doc: update CoalesceXXX demo and result (#594) 2025-02-22 20:35:39 +01:00
shunsuke takii
fe0618f731 docs: modify mutable example docs (#595)
docs: modify mutable example docs
2025-02-22 20:33:42 +01:00
overbeck
0fa0632c0f Perf(slice): Optimize iteration function parameters and add test cases (#587)
- Modify the iteration function parameters in the UniqueBy, GroupByMap, and Keyify functions to use index access for collection elements.
- Optimize parameter naming in the GroupByMap function to improve code readability.
- Add test cases for the GroupByMap function to cover different types of inputs.

Co-authored-by: ShuQingZai <overbeck.jack@outlook.com>
2025-02-17 00:10:10 +01:00
dependabot[bot]
12a8b78b75 chore(deps): bump golang.org/x/text from 0.21.0 to 0.22.0 (#590)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.21.0 to 0.22.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.21.0...v0.22.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-10 12:10:24 +01:00
Samuel Berthe
70b763eac5 Merge branch 'maryum375-master' 2025-01-28 20:25:26 +01:00
Samuel Berthe
ce12685a40 fix(groupbymap): remove second iteratee and add test+example+doc 2025-01-28 20:25:04 +01:00
Ran Mariuma
19cb99199d Implemented GroupByMapValues 2025-01-28 20:12:52 +01:00
Samuel Berthe
96d5482643 fix(product): fix empty slice behavior (#583) (#584) 2025-01-28 12:35:04 +01:00
Samuel Berthe
2bdcacae5e doc: add example for Product and ProductBy 2025-01-27 01:05:21 +01:00
JohnDevitt
1c1dfd9d29 feat: add Product and ProductBy functions (#566)
Co-authored-by: John.Devitt@cdp.net <JohnDevitt@Mac.cust.communityfibre.co.uk>
2025-01-27 01:02:11 +01:00
Samuel Berthe
124d3004de feat: adding FilterSliceToMap (#581) 2025-01-26 23:32:59 +01:00
Samuel Berthe
19d8355ae8 Merge branch 'Lee-Minjea-feat/throttle' 2025-01-26 22:49:20 +01:00
Samuel Berthe
5cd32660f6 feat: adding ExampleNewThrottleBy and ExampleNewThrottleByWithCount 2025-01-26 22:47:39 +01:00
Lee,Minjea
fdd886509a fix: test case fixed 2025-01-26 19:59:39 +01:00
minjea.lee
27638ea5b7 feat: adding NewThrottle (#396) 2025-01-26 19:59:39 +01:00
Samuel Berthe
d5876775c8 feat: faster ChunkEntries 2025-01-26 19:51:43 +01:00