Commit Graph

338 Commits

Author SHA1 Message Date
Samuel Berthe 105f9555f0 doc(exp,simd): adding warning about API stability for code under exp/ (#808) 2026-02-21 19:49:03 +01:00
Varun Chawla 0b4623da1e fix: make Ellipsis operate on runes instead of bytes to prevent Unicode truncation (#796)
* fix: make Ellipsis operate on runes instead of bytes to prevent Unicode truncation

The Ellipsis function previously used byte-based length counting (len(str))
and byte-based slicing (str[:length-3]), which could split multi-byte
Unicode characters in the middle, producing garbled output.

This changes the function to use []rune conversion so the length parameter
counts Unicode code points instead of bytes. Emoji, CJK ideographs, and
other multi-byte characters are now never split in the middle.

Fixes #520

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: avoid rune slice allocation in Ellipsis

Use range-based iteration to count runes without allocating a []rune
slice, per reviewer suggestion. The early-return for length < 3 is
kept explicit for clarity.

* Simplify Ellipsis: remove early return for length < 3, reuse ellipsis const

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 19:29:10 +01:00
Samuel Berthe cbdb302c7e Added sponsorship
Added sponsorship section to README with DBOS details.
2026-02-19 15:57:21 +01:00
Samuel Berthe fedd0b6d2d doc: explain chunkstring inconsistency (#789)
* doc: explain chunkstring inconsistency

* doc: explain chunkstring inconsistency
2026-01-27 18:53:04 +01:00
Seth Isernhagen 37c07828c3 Fix Clone() go playground link in README (#761)
- fix copy-paste error in README.md

Why?

New link points to the correct Go playground example for Clone() method.
2026-01-07 17:28:34 +01:00
Yuliya b6154d0f8d feat: add Take, TakeWhile, FilterTake, Window, and Sliding functions (#760)
* feat: add Take, TakeWhile, FilterTake, Window, and Sliding functions

Add five new slice manipulation functions with tests, examples, and documentation.

* improve Take function safety and add benchmarks

* rename FilterTake to TakeFilter and add README docs

* remove Window and Sliding benchmarks

* apply gofmt and fix linter errors

* apply gofmt and fix linter errors
2026-01-07 17:28:08 +01:00
Samuel Berthe d99edab80d Refactoring lo.IntersectBy + adding loit.IntersectBy + adding doc (#739)
* feat(intersectby): form transform callback in first position and add support for vaarg

* feat(it): adding loit.IntersectBy

* doc: adding lo.IntersectBy + loit.IntersectBy

* doc: adding lo.IntersectBy + loit.IntersectBy

* style: fix linter

* doc: adding example for lo.IntersectBy
2025-11-07 01:23:34 +01:00
Nathan Baulch e7386d9246 lint: fix inconsistent callback function parameter names (#730)
* Fix linting

* Use is.ElementsMatch

This will ignore the ordering of the final intersection. Especially
important when checking old versions of go that do not guarantee an order
when iterating through maps.

* lint: fix inconsistent callback function parameter names

* lint: rename "iteratee" to "transform" for *Map helpers

* lint: rename "project" parameters to "transform"

* lint: rename "cb" parameters to "callback"

* lint: rename "iteratee" to "callback" for ForEach helpers

---------

Co-authored-by: Franky W. <frankywahl@users.noreply.github.com>
Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-11-06 18:05:11 +01:00
Nathan Baulch 48d8fe40e5 fix: rename IsSortedByKey to IsSortedBy (#735)
* Fix linting

* Use is.ElementsMatch

This will ignore the ordering of the final intersection. Especially
important when checking old versions of go that do not guarantee an order
when iterating through maps.

* fix: rename IsSortedByKey to IsSortedBy

---------

Co-authored-by: Franky W. <frankywahl@users.noreply.github.com>
Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-11-06 17:54:13 +01:00
quexer 41f7af2114 Add Clone function to return shallow copy of slice collections (#732)
* Initial plan

* Add Clone function to return shallow copy of slice collection

Co-authored-by: quexer <92157+quexer@users.noreply.github.com>

* Update slice.go

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>

* Update slice_test.go

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>

* doc and test

* Apply suggestions from code review

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: quexer <92157+quexer@users.noreply.github.com>
Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-11-06 17:47:04 +01:00
Franky W. ed8ee742a6 Allow Union/Intersect to take many lists (#181)
* Allow Union to take many lists

* Allow Intersect to take many lists

* Allow for any number of intersection arguments

* Do not use recursion

Optimize Intersect to avoid using recursion and reduce computation

* Add ExampleIntersect

Adds an example test for intersect

* Add example for Intersect in Readme

* Update docs for Intersect
2025-11-05 23:04:41 +01:00
Samuel Berthe ffc3e1880a doc(maxby): adding comment to explain inconsistency (#727) 2025-11-05 19:34:20 +01:00
Samuel Berthe 734a6b156c feat(it): adding loit.Concat (#722) 2025-10-25 21:11:08 +02:00
Samuel Berthe 56c9241b83 style: move img/ directory into docs/static/img (#721) 2025-10-25 17:29:56 +02:00
Samuel Berthe 7650d43953 chore(dependabot): fix yaml typo 2025-10-20 17:17:11 +02:00
Samuel Berthe f3e6605d3f doc: explain difference between ro and lo 2025-10-14 20:58:25 +02:00
Samuel Berthe 650c9c2034 Fix formatting in README.md links section 2025-10-14 16:27:19 +02:00
Samuel Berthe c7e9459a8b docs: lots of various doc improvements (#706) 2025-10-08 14:55:05 +02:00
Samuel Berthe 8b8aa284f3 fix(doc): make "iter" package visible in doc sidebar 2025-10-06 19:26:51 +02:00
Samuel Berthe 71a4a8c34a doc: add link to documentation in readme 2025-10-06 17:15:00 +02:00
Samuel Berthe 4d877c7d51 Update README.md 2025-10-04 18:22:46 +02:00
Samuel Berthe f73396345c Update README.md
Added a support section for sponsorship in the README.
2025-10-04 04:32:02 +02:00
Nathan Baulch 1b92b5c7db lint: enable 7 more linters (#686)
* lint: enable and fix perfsprint issues

* lint: enable and fix nolintlint issues

* lint: enable and fix godot issues

* lint: enable and fix thelper issues

* lint: enable and fix tparallel issues

* lint: enable and fix paralleltest issues

* lint: enable and fix predeclared issues
2025-09-25 13:18:25 +02:00
Samuel Berthe ec86b574ed feat: adding TrimXXX methods (#683) 2025-09-25 04:15:30 +02:00
Alex Klepov 21a523ddc0 Added Cut, CutPrefix, CutSuffix (#666)
* Added Cut, CutPrefix, CutSuffix

* fix readme

* Clarify Cut, CutPrefix, and CutSuffix documentation

Updated descriptions and examples for Cut, CutPrefix, and CutSuffix functions to clarify usage with slices.

* Refactor Cut, CutPrefix, and CutSuffix functions

* Update slice_test.go

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-09-25 01:52:48 +02:00
Samuel Berthe 928ed09f00 doc(readme): added missing link in menu section 2025-09-24 23:40:00 +02:00
Samuel Berthe 9a5336a8f9 feat: adding hassuffix + hasprefix (#680) 2025-09-24 23:18:51 +02:00
Nathan Baulch 3210326df6 chore: minor whitespace fixes (#677)
* lint: pin golangci-lint version

* chore: minor whitespace fixes

* lint: enable whitespace linter

* Apply suggestions from code review

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-09-24 22:48:54 +02:00
Nathan Baulch 3e11f11781 docs: grammar improvements (#673)
* lint: pin golangci-lint version

* docs: grammar fixes

* docs: remove "truthy" terminology

* docs: remove "array" terminology

* docs: grammar fixes

* Update .github/workflows/lint.yml

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-09-24 20:59:41 +02:00
Samuel Berthe 7e6d6e0673 chore: remove docker - a lightweight project is beautiful 2025-09-24 16:22:38 +02:00
Samuel Berthe 3bc887c57c doc: adding go playground examples 2025-09-23 14:54:30 +02:00
Samuel Berthe 579fdad713 feat: adding FilterValues and fix FilterKeys signature (#661)
* feat: adding FilterValues and fix FilterKeys signature

* oops
2025-08-24 12:43:12 +02:00
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 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
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
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 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
Ahmed Ashraf 2bc3746616 fix typo in readme (#620) 2025-04-13 00:19:30 +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