Commit Graph

869 Commits

Author SHA1 Message Date
dependabot[bot] 7dd75a898b chore(deps): bump dompurify from 3.3.2 to 3.4.0 in /docs (#864)
Bumps [dompurify](https://github.com/cure53/DOMPurify) from 3.3.2 to 3.4.0.
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](https://github.com/cure53/DOMPurify/compare/3.3.2...3.4.0)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-version: 3.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-22 01:16:52 +02:00
Samuel Berthe 33a3ca545c doc(docusaurus): prepare upgrade to docusaurus 3.10 2026-04-22 01:13:26 +02:00
Jay Pipes 6a523f9847 (fix) Correct misplaced Markdown codeblock in Some example (#862)
Tiny little fix to correct a Markdown formatting issue with the example for `lo.Some()`
2026-04-22 01:08:29 +02:00
Samuel Berthe 4cad1fbce5 doc(docusaurus): prepare upgrade to docusaurus 3.10 2026-04-22 01:00:21 +02:00
Samuel Berthe a02446aad8 fix(seo): sync meta tags, robots.txt and sitemap config from samber/do
- Add twitter:site, og:locale, og:site_name head tags
- Add fallback description meta tag
- Exclude /search from sitemap
- Disallow /search and /tags/ in robots.txt
2026-04-21 17:46:18 +02:00
Samuel Berthe bf90b8e378 fix(seo): fix wrong url domain + remove duplicate global canonical + add robots.txt
- url was pointing to ro.samber.dev instead of lo.samber.dev
  This caused every canonical tag, sitemap URL and og:url across
  the entire lo.samber.dev docs site to reference the wrong domain,
  causing Google to treat all lo pages as duplicates of ro.samber.dev
  content (explaining the 6/7 pages not indexed in GSC, og:url mismatch,
  and the 74 non-canonical pages in ro.samber.dev sitemap in Ahrefs)

- Remove global <link rel="canonical"> from headTags: Docusaurus already
  generates correct per-page canonical tags from the url field; a global
  one hardcoded to the homepage created conflicting duplicate canonicals
  on every page, making Google ignore them

- Add docs/static/robots.txt: was missing, causing robots.txt inaccessible
  warnings in Ahrefs across all crawled properties
2026-04-21 17:30:17 +02:00
Samuel Berthe 287e689e5b fix doc build 2026-04-17 20:09:42 +02:00
Samuel Berthe fcfba1caa2 improve seo 2026-04-17 20:09:42 +02:00
Samuel Berthe 0dbb62e030 Revert "chore(deps): bump @mermaid-js/layout-elk from 0.1.9 to 0.2.1 in /docs…" (#865)
This reverts commit 891b429fa0.
2026-04-17 20:06:41 +02:00
Samuel Berthe 16b96cf912 adding posthog 2026-04-17 14:17:02 +02:00
dependabot[bot] bf49630802 chore(deps): bump follow-redirects from 1.15.11 to 1.16.0 in /docs (#863)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.11 to 1.16.0.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.11...v1.16.0)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-version: 1.16.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 23:25:46 +02:00
dependabot[bot] 891b429fa0 chore(deps): bump @mermaid-js/layout-elk from 0.1.9 to 0.2.1 in /docs (#856)
Bumps [@mermaid-js/layout-elk](https://github.com/mermaid-js/mermaid) from 0.1.9 to 0.2.1.
- [Release notes](https://github.com/mermaid-js/mermaid/releases)
- [Commits](https://github.com/mermaid-js/mermaid/compare/@mermaid-js/layout-elk@0.1.9...@mermaid-js/layout-elk@0.2.1)

---
updated-dependencies:
- dependency-name: "@mermaid-js/layout-elk"
  dependency-version: 0.2.1
  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>
2026-04-01 11:53:11 +02:00
dependabot[bot] 9e759c3ba6 chore(deps-dev): bump typescript from 5.9.3 to 6.0.2 in /docs (#857)
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.9.3 to 6.0.2.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.9.3...v6.0.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-version: 6.0.2
  dependency-type: direct:development
  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>
2026-04-01 11:52:57 +02:00
dependabot[bot] 56b1d6d472 chore(deps): bump codecov/codecov-action from 5 to 6 (#855)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5 to 6.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: '6'
  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>
2026-04-01 11:47:09 +02:00
dependabot[bot] 1467d6acbd chore(deps): bump brace-expansion from 1.1.12 to 1.1.13 in /docs (#854)
Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 1.1.12 to 1.1.13.
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](https://github.com/juliangruber/brace-expansion/compare/v1.1.12...v1.1.13)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 1.1.13
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-31 14:43:43 +02:00
dependabot[bot] e36b88c93e chore(deps): bump picomatch from 2.3.1 to 2.3.2 in /docs (#848)
Bumps [picomatch](https://github.com/micromatch/picomatch) from 2.3.1 to 2.3.2.
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-31 14:35:46 +02:00
dependabot[bot] 102bb75fc4 chore(deps): bump node-forge from 1.3.2 to 1.4.0 in /docs (#851)
Bumps [node-forge](https://github.com/digitalbazaar/forge) from 1.3.2 to 1.4.0.
- [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md)
- [Commits](https://github.com/digitalbazaar/forge/compare/v1.3.2...v1.4.0)

---
updated-dependencies:
- dependency-name: node-forge
  dependency-version: 1.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-31 14:35:35 +02:00
dependabot[bot] 31d52251e9 chore(deps): bump path-to-regexp from 0.1.12 to 0.1.13 in /docs (#853)
Bumps [path-to-regexp](https://github.com/pillarjs/path-to-regexp) from 0.1.12 to 0.1.13.
- [Release notes](https://github.com/pillarjs/path-to-regexp/releases)
- [Changelog](https://github.com/pillarjs/path-to-regexp/blob/v.0.1.13/History.md)
- [Commits](https://github.com/pillarjs/path-to-regexp/compare/v0.1.12...v.0.1.13)

---
updated-dependencies:
- dependency-name: path-to-regexp
  dependency-version: 0.1.13
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-31 14:35:27 +02:00
Samuel Berthe 29de7237e3 chore: remove dockerfile 2026-03-31 14:33:56 +02:00
Samuel Berthe a17e3ac882 chore(ci): adding trivy 2026-03-26 00:23:14 +01:00
Samuel Berthe f6ccfb57ff Add AI Agent Skill integration instructions
Added instructions for integrating AI Agent Skill with the library.
2026-03-23 04:10:07 +01:00
Samuel Berthe edff69da97 Update about.md with AI Agent Skill installation
Added installation instructions for AI Agent Skill.
2026-03-23 04:09:14 +01:00
Samuel Berthe 93dd505499 Update README with AI Agent Skill installation
Added installation instructions for AI Agent Skill.
2026-03-23 04:05:20 +01:00
Samuel Berthe 237598defd Add link to samber/cc-skills-golang in README 2026-03-22 03:09:16 +01:00
Samuel Berthe 4d1dbfadf7 chore(linter): adding modernize linter (#841) 2026-03-08 00:17:11 +01:00
Samuel Berthe fd29945fb1 refactor(benchmarks): reorganize benchark/ directory (#840) 2026-03-08 00:14:41 +01:00
Samuel Berthe 191e7112e8 perf: use value receivers for If/Switch fluent chains (#839)
* perf: use value receivers for If/Switch fluent chains

Replace pointer receivers with value receivers on ifElse and switchCase
types. This enables the compiler to fully inline the fluent chain calls,
eliminating pointer indirection overhead.

Benchstat (go1.24, darwin/arm64, -count=6 -cpu=1):

                │   before    │        after         │
                │   sec/op    │  sec/op   vs base    │
If              0.5222n ± 7%  0.2545n ± 9%  -51.26% (p=0.002)
IfElseIf        1.0710n ± 3%  0.2516n ± 3%  -76.50% (p=0.002)
IfElseIfChain   1.9265n ± 1%  0.2524n ± 2%  -86.90% (p=0.002)
Switch          1.5965n ± 2%  0.2525n ± 1%  -84.18% (p=0.002)
SwitchChain     2.3940n ± 1%  0.2521n ± 1%  -89.47% (p=0.002)
geomean          1.327n       0.2526n       -80.97%

* 💄
2026-03-07 18:56:48 +01:00
Samuel Berthe d66010f2c1 perf: replace NthOrEmpty with direct loops in Zip2-Zip9 (#838)
Replace the single interleaved loop calling NthOrEmpty per element
with separate per-slice loops using direct index access. This
eliminates function call overhead (NthOrEmpty → sliceNth → bounds
check) and improves CPU cache locality by processing each input
slice contiguously.

The result slice is zero-initialized by make(), so out-of-bounds
elements (when slices have different lengths) are already zero —
no explicit zero-filling needed.

Benchstat (Apple M3, 6 runs, -cpu=1):

                    │   before    │           after            │
                    │   sec/op    │  sec/op    vs base         │
Zip2_Equal/n_10       65.89n ± 22%  52.35n ± 13%  -20.54% (p=0.002)
Zip2_Equal/n_100      440.6n ± 21%  382.3n ± 13%  -13.22% (p=0.004)
Zip2_Equal/n_1000     4.232µ ± 82%  3.173µ ± 12%  -25.02% (p=0.002)
Zip2_Unequal/n_10     69.35n ± 65%  46.16n ±  1%  -33.43% (p=0.002)
Zip2_Unequal/n_100    461.8n ±101%  293.1n ± 17%  -36.53% (p=0.002)
Zip2_Unequal/n_1000   3.623µ ± 26%  2.301µ ± 17%  -36.49% (p=0.002)
geomean               492.4n        354.3n        -28.05%
2026-03-06 22:57:44 +01:00
Samuel Berthe e9ad51b03a perf: add map capacity hints to Mode and it.UniqKeys/UniqValues (#837)
- Mode: make(map[T]int) → make(map[T]int, len(collection))
- it.UniqKeys: compute total size from input maps for seen map hint
- it.UniqValues: compute total size from input maps for seen map hint

Avoids repeated map rehashing as entries are added.
2026-03-06 17:10:17 +01:00
Samuel Berthe 6572c7fd22 perf(map): add size hints to PickBy/OmitBy family (#836)
Pre-allocate maps with size hints instead of empty map literals
to avoid repeated rehashing as entries are added.

- PickBy, PickByErr: make(Map, len(in))
- PickByKeys: make(Map, len(keys))
- PickByValues: make(Map, len(values))
- OmitBy, OmitByErr, OmitByKeys, OmitByValues: make(Map, len(in))
2026-03-06 01:34:35 +01:00
Samuel Berthe 0d0ceb74f1 oops 2026-03-06 00:45:55 +01:00
Samuel Berthe b11e461ff4 perf: preallocate maps and slices in CountValues, UniqKeys, UniqValues, FilterKeys, FilterValues, FilterKeysErr, FilterValuesErr (#833)
* perf: preallocate maps and slices in CountValues, UniqKeys, UniqValues, FilterKeys, FilterValues, FilterKeysErr, FilterValuesErr

Add size hints to map and slice allocations to avoid repeated
grow-and-copy reallocations:
- CountValues: make(map[T]int, len(collection))
- UniqKeys/UniqValues: make([]K, 0, size)
- FilterKeys/FilterValues/FilterKeysErr/FilterValuesErr: make([]K, 0, len(in))

* oops
2026-03-06 00:35:45 +01:00
Samuel Berthe fa095e4b4f fix(doc): fix go playground demo URL (#832)
* fix(doc): fix go playground demo URL

* fix(doc): add more go playground demo URL
2026-03-06 00:09:59 +01:00
Samuel Berthe dc372c082b perf: use direct index assignment in RepeatBy, Fill, Repeat (#834)
Replace make([]T, 0, count) + append with make([]T, count) + result[i] = ...
since the final size is known upfront. Eliminates per-element append overhead.

Also adds comprehensive benchmark coverage for all helpers across
core, it, mutable, and parallel packages (282 benchmark functions).
2026-03-06 00:04:16 +01:00
Samuel Berthe c9a2290463 perf: use direct loop in FromSlicePtr, FromSlicePtrOr (#831)
Replace indirect Map() call with closure by a direct loop,
eliminating per-element function call overhead.
2026-03-05 21:25:46 +01:00
Samuel Berthe 1f669cbc2d perf: preallocate result slices in Difference (#830)
Difference previously initialized left and right as empty slice
literals (Slice{}), causing repeated grow-and-copy allocations
as elements were appended.

Now preallocates with make(Slice, 0, len(listN)) to avoid
unnecessary reallocations.
2026-03-05 21:15:05 +01:00
Samuel Berthe e82e7f5d7d perf: avoid double iteration in UniqMap (#829)
UniqMap previously built a map then called Keys(seen) which:
1. Iterated the map a second time to extract keys
2. Returned keys in non-deterministic map iteration order
3. Allocated a separate slice inside Keys()

Now collects results directly during the single pass, preserving
insertion order and eliminating the redundant iteration.
2026-03-05 18:53:43 +01:00
dependabot[bot] 7c2d883a34 chore(deps): bump dompurify from 3.2.7 to 3.3.2 in /docs (#828)
Bumps [dompurify](https://github.com/cure53/DOMPurify) from 3.2.7 to 3.3.2.
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](https://github.com/cure53/DOMPurify/compare/3.2.7...3.3.2)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-version: 3.3.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-05 18:53:27 +01:00
Samuel Berthe f7891eb41c perf: preallocate result slice in Reject, RejectErr, RejectMap (#827)
* perf(Reject): preallocate result slice capacity

Reject was using `Slice{}` (zero capacity) causing multiple
grow-and-copy allocations as elements were appended. Preallocate
with `make(Slice, 0, len(collection))` to eliminate regrowth.

benchstat (strings_1000): -42.96% time, -53.37% memory, -88.89% allocs

* perf(Reject): preallocate result slice in Reject, RejectErr, RejectMap

All three Reject variants were using zero-capacity slices (`Slice{}`
or `[]R{}`), causing multiple grow-and-copy allocations as elements
were appended. Preallocate with `make(..., 0, len(collection))` to
eliminate slice regrowth.

Reject benchstat (strings_1000): -42.96% time, -53.37% memory, -88.89% allocs
RejectErr benchstat (strings_1000): -45.11% time, -53.37% memory, -88.89% allocs
RejectMap benchstat (strings_1000): -47.63% time, -53.37% memory, -88.89% allocs
2026-03-05 18:12:24 +01:00
dependabot[bot] e9058fd5e5 chore(deps): bump svgo from 3.3.2 to 3.3.3 in /docs (#826)
Bumps [svgo](https://github.com/svg/svgo) from 3.3.2 to 3.3.3.
- [Release notes](https://github.com/svg/svgo/releases)
- [Commits](https://github.com/svg/svgo/compare/v3.3.2...v3.3.3)

---
updated-dependencies:
- dependency-name: svgo
  dependency-version: 3.3.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-05 16:44:56 +01:00
Adam Szaraniec 56ef3beaf8 feat: support for buffer iterator (#824)
* support for buffer iterator

* Code review fix

* fix: transforming the Buffer helper into a pull-based operator (it receives an iterator instead of channel)

* doc(it): adding loit.Buffer to doc

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2026-03-02 16:07:14 +01:00
Samuel Berthe 6a9f881ae1 💄 2026-03-02 16:06:51 +01:00
Samuel Berthe 7f0c2e0297 feat: adding UnzipByErrX helpers 2026-03-02 16:06:51 +01:00
Samuel Berthe af46a13bfc feat: adding RejectErr helpers 2026-03-02 16:06:51 +01:00
Samuel Berthe 6f42e74a11 doc: improve examples 2026-03-02 16:06:51 +01:00
Samuel Berthe ff0e293ce3 feat: adding FilterErr helpers 2026-03-02 16:06:51 +01:00
Samuel Berthe 4bb58fd2c6 feat: adding RepeatByErr helpers 2026-03-02 16:06:51 +01:00
Samuel Berthe 72a33aa397 feat: adding FilterKeysErr + FilterValuesErr helpers 2026-03-02 16:06:51 +01:00
Samuel Berthe dd1d58e324 feat: adding FindDuplicatesByErr helper 2026-03-02 16:06:51 +01:00
Samuel Berthe 693e1ce3a8 feat: adding FilterMapToSliceErr helper 2026-03-02 16:06:51 +01:00