fix(doc): fix go playground demo URL (#832)

* fix(doc): fix go playground demo URL

* fix(doc): add more go playground demo URL
This commit is contained in:
Samuel Berthe
2026-03-06 00:09:59 +01:00
committed by GitHub
parent dc372c082b
commit fa095e4b4f
204 changed files with 471 additions and 311 deletions
+85 -8
View File
@@ -201,17 +201,94 @@ Use these established subCategories:
## Go Playground Examples
Every helper must have a working Go Playground example:
1. Create a minimal, self-contained example
2. Use realistic but simple data
3. Include the expected result as a comment
4. Test the example to ensure it works
Every helper must have a working Go Playground example linked in two places:
When creating the go playground examples, please run it to be sure it compiles and returns the expected output. If invalid, loop until it works.
1. **Source code**: `// Play: <url>` comment on the last line of the doc block, right before the `func` keyword
2. **Doc file**: `playUrl: <url>` field in the YAML frontmatter of `docs/data/<category>-<slug>.md`
Add these examples in the source code comments, on top of helpers, with a syntax like `// Play: <url>`.
### Creating a New Playground Example
If the documentation is created at the same time of the helper source code, then the Go playground execution might fail, since we need to merge+release the source code first to make this new helper available to Go playground compiler. In that case, skip the creation of the example and set no URL.
#### Step 1: Write the Example Code
Write a minimal, self-contained `main.go` that demonstrates the helper. Guidelines:
- Use realistic but simple data
- Print the result with `fmt.Println` so the output is visible
- Include edge cases when useful (e.g., empty input, error case)
- For `Err` variants, show both a success and an error case
- For time-based helpers, use `time.Date()` for deterministic output
- For random helpers (`SampleBy`, `SamplesBy`), use `rand.New(rand.NewSource(42))` for reproducible output
#### Step 2: Import Conventions
Use the correct import path depending on the package:
```go
// Core helpers
import "github.com/samber/lo"
// Usage: lo.Map(...)
// Iterator helpers (it/ package, requires Go 1.23+)
import (
"slices"
"github.com/samber/lo/it"
)
// Usage: slices.Collect(it.Map(...))
// Convert slices to iterators: slices.Values([]int{1, 2, 3})
// Parallel helpers
import lop "github.com/samber/lo/parallel"
// Usage: lop.Map(...)
```
#### Step 3: Run and Share via Go Playground
Use the `go-playground` MCP tool to execute the example and get a shareable URL:
```
mcp__go-playground__run_and_share_go_code(code: "<your code>")
```
This compiles the code on go.dev/play, runs it, and returns:
- The program output (to verify correctness)
- A shareable URL like `https://go.dev/play/p/XXXXXXX`
If the output doesn't match expectations, fix the code and re-run until it produces the correct result.
#### Step 4: Add the URL to Source Code
Add a `// Play:` comment as the **last line** of the function's doc comment block:
```go
// Map manipulates a slice and transforms it to a slice of another type.
// Play: https://go.dev/play/p/refNB9ZTIGo
func Map[T any, R any](collection []T, iteratee func(item T, index int) R) []R {
```
#### Step 5: Add the URL to Documentation
Set the `playUrl` field in the corresponding `docs/data/*.md` file:
```yaml
---
name: Map
slug: map
playUrl: https://go.dev/play/p/refNB9ZTIGo
...
---
```
### Troubleshooting
**First-run timeouts**: The Go Playground may timeout on the first execution if `github.com/samber/lo` hasn't been cached yet. Simply retry — subsequent runs succeed because the module is cached.
**New helpers not yet released**: If documentation is created at the same time as the helper source code, the Go Playground cannot compile it because the module version hasn't been published yet. In that case, skip the playground example and leave `playUrl` empty. Create the example after the next release.
**SIMD helpers**: Helpers in `exp/simd/` require `go1.26+goexperiment.simd+amd64` build tags, which the Go Playground does not support. These helpers cannot have playground examples.
### Bulk Verification
To verify all playground URLs compile, you can use `mcp__go-playground__execute_go_playground_url` to re-run an existing URL and check the output. To read the source code of an existing playground, use `mcp__go-playground__read_go_playground_url`.
## Example: Complete File
+1 -1
View File
@@ -4,7 +4,7 @@ slug: camelcase
sourceRef: string.go#L176
category: core
subCategory: string
playUrl: https://go.dev/play/p/Go6aKwUiq59
playUrl: https://go.dev/play/p/4JNDzaMwXkm
variantHelpers:
- core#string#camelcase
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: clone
sourceRef: slice.go#L741
category: core
subCategory: slice
playUrl:
playUrl: https://go.dev/play/p/66LJ2wAF0rN
variantHelpers:
- core#slice#clone
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: concat
sourceRef: slice.go#L282
category: core
subCategory: slice
playUrl:
playUrl: https://go.dev/play/p/Ux2UuR2xpRK
variantHelpers:
- core#slice#concat
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: countby
sourceRef: slice.go#L849
category: core
subCategory: slice
playUrl: https://go.dev/play/p/ByQbNYQQi4X
playUrl: https://go.dev/play/p/5GMQP5vNT4q
variantHelpers:
- core#slice#countby
similarHelpers:
+1
View File
@@ -8,6 +8,7 @@ signatures:
- "func CountByErr[T any](collection []T, predicate func(item T) (bool, error)) (int, error)"
variantHelpers:
- core#slice#countbyerr
playUrl: https://go.dev/play/p/7BnyPhpG6lW
similarHelpers:
- core#slice#countby
- core#slice#count
+1 -1
View File
@@ -4,7 +4,7 @@ slug: cutprefix
sourceRef: slice.go#L800
category: core
subCategory: slice
playUrl: https://go.dev/play/p/7Plak4a1ICl
playUrl: https://go.dev/play/p/P1scQj53aFa
variantHelpers:
- core#slice#cutprefix
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: droprightwhile
sourceRef: slice.go#L486
category: core
subCategory: slice
playUrl: https://go.dev/play/p/3-n71oEC0Hz
playUrl: https://go.dev/play/p/HBh8pHl-ZZz
variantHelpers:
- core#slice#droprightwhile
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: dropwhile
sourceRef: slice.go#L472
category: core
subCategory: slice
playUrl: https://go.dev/play/p/7gBPYw2IK16
playUrl: https://go.dev/play/p/b_PYomVQLGy
variantHelpers:
- core#slice#dropwhile
similarHelpers:
+1 -1
View File
@@ -17,7 +17,7 @@ signatures:
- "func Duration8[T, U, V, W, X, Y, Z, A any](callback func() (T, U, V, W, X, Y, Z, A)) (T, U, V, W, X, Y, Z, A, time.Duration)"
- "func Duration9[T, U, V, W, X, Y, Z, A, B any](callback func() (T, U, V, W, X, Y, Z, A, B)) (T, U, V, W, X, Y, Z, A, B, time.Duration)"
- "func Duration10[T, U, V, W, X, Y, Z, A, B, C any](callback func() (T, U, V, W, X, Y, Z, A, B, C)) (T, U, V, W, X, Y, Z, A, B, C, time.Duration)"
playUrl: https://go.dev/play/p/HQfbBbAXaFP
playUrl: https://go.dev/play/p/LFhKq2vY9Ty
variantHelpers:
- core#time#duration
- core#time#durationx
+1 -1
View File
@@ -4,7 +4,7 @@ slug: earliest
sourceRef: find.go#L363
category: core
subCategory: find
playUrl:
playUrl: https://go.dev/play/p/pRyy0c6hsBs
variantHelpers:
- core#find#earliest
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: earliestby
sourceRef: find.go#L462
category: core
subCategory: find
playUrl:
playUrl: https://go.dev/play/p/0XvCF6vuLXC
variantHelpers:
- core#find#earliestby
similarHelpers:
+1
View File
@@ -4,6 +4,7 @@ slug: earliestbyerr
sourceRef: find.go#L484
category: core
subCategory: find
playUrl: https://go.dev/play/p/zJUBUj7ANvq
variantHelpers:
- core#find#earliestbyerr
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: core
subCategory: slice
signatures:
- "func FilterErr[T any, Slice ~[]T](collection Slice, predicate func(item T, index int) (bool, error)) (Slice, error)"
playUrl:
playUrl: https://go.dev/play/p/Apjg3WeSi7K
variantHelpers:
- core#slice#filtererr
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: core
subCategory: map
signatures:
- "func FilterKeysErr[K comparable, V any](in map[K]V, predicate func(key K, value V) (bool, error)) ([]K, error)"
playUrl:
playUrl: https://go.dev/play/p/j2gUQzCTu4t
variantHelpers:
- core#map#filterkeyserr
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: core
subCategory: map
signatures:
- "func FilterMapToSliceErr[K comparable, V any, R any](in map[K]V, iteratee func(key K, value V) (R, bool, error)) ([]R, error)"
playUrl:
playUrl: https://go.dev/play/p/YjFEORLBWvk
variantHelpers:
- core#map#filtermaptosliceerr
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: filterslicetomap
sourceRef: slice.go#L414
category: core
subCategory: slice
playUrl: https://go.dev/play/p/2z0rDz2ZSGU
playUrl: https://go.dev/play/p/eurMiQEqey2
variantHelpers:
- core#slice#filterslicetomap
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: core
subCategory: map
signatures:
- "func FilterValuesErr[K comparable, V any](in map[K]V, predicate func(key K, value V) (bool, error)) ([]V, error)"
playUrl:
playUrl: https://go.dev/play/p/hKvHlqLzbdE
variantHelpers:
- core#map#filtervalueserr
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: findduplicates
sourceRef: find.go#L207
category: core
subCategory: find
playUrl:
playUrl: https://go.dev/play/p/muFgL_XBwoP
variantHelpers:
- core#find#findduplicates
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: findduplicatesby
sourceRef: find.go#L234
category: core
subCategory: find
playUrl:
playUrl: https://go.dev/play/p/LKdYdNHuGJG
variantHelpers:
- core#find#findduplicatesby
- core#find#findduplicatesbyerr
+1
View File
@@ -4,6 +4,7 @@ slug: findduplicatesbyerr
sourceRef: find.go#L296
category: core
subCategory: find
playUrl: https://go.dev/play/p/HiVILQqdFP0
signatures:
- "func FindDuplicatesByErr[T any, U comparable, Slice ~[]T](collection Slice, iteratee func(item T) (U, error)) (Slice, error)"
variantHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: core
subCategory: find
signatures:
- "func FindErr[T any](collection []T, predicate func(item T) (bool, error)) (T, error)"
playUrl:
playUrl: https://go.dev/play/p/XK-qtpQWXJ9
variantHelpers: []
similarHelpers:
- core#find#find
+1 -1
View File
@@ -4,7 +4,7 @@ slug: findlastindexof
sourceRef: find.go#L101
category: core
subCategory: find
playUrl: https://go.dev/play/p/dPiMRtJ6cUx
playUrl: https://go.dev/play/p/2VhPMiQvX-D
variantHelpers:
- core#find#findlastindexof
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: finduniques
sourceRef: find.go#L152
category: core
subCategory: find
playUrl:
playUrl: https://go.dev/play/p/NV5vMK_2Z_n
variantHelpers:
- core#find#finduniques
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: finduniquesby
sourceRef: find.go#L178
category: core
subCategory: find
playUrl:
playUrl: https://go.dev/play/p/2vmxCs4kW_m
variantHelpers:
- core#find#finduniquesby
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: first
sourceRef: find.go#L554
category: core
subCategory: find
playUrl: https://go.dev/play/p/ul45Z0y2EFO
playUrl: https://go.dev/play/p/94lu5X6_cbf
variantHelpers:
- core#find#first
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: firstor
sourceRef: find.go#L574
category: core
subCategory: find
playUrl: https://go.dev/play/p/ul45Z0y2EFO
playUrl: https://go.dev/play/p/x9CxQyRFXeZ
variantHelpers:
- core#find#firstor
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: firstorempty
sourceRef: find.go#L567
category: core
subCategory: find
playUrl: https://go.dev/play/p/ul45Z0y2EFO
playUrl: https://go.dev/play/p/i200n9wgrDA
variantHelpers:
- core#find#firstorempty
similarHelpers:
+1
View File
@@ -4,6 +4,7 @@ slug: groupbyerr
sourceRef: slice.go#L279
category: core
subCategory: slice
playUrl: https://go.dev/play/p/BzKPcY3AdX2
signatures:
- "func GroupByErr[T any, U comparable, Slice ~[]T](collection Slice, iteratee func(item T) (U, error)) (map[U]Slice, error)"
variantHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: interleave
sourceRef: slice.go#L282
category: core
subCategory: slice
playUrl: https://go.dev/play/p/-RJkTLQEDVt
playUrl: https://go.dev/play/p/KOVtGUt-tdI
variantHelpers:
- core#slice#interleave
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: intersectby
sourceRef: intersect.go#L174
category: core
subCategory: intersect
playUrl:
playUrl: https://go.dev/play/p/uWF8y2-zmtf
variantHelpers:
- core#intersect#intersectby
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: kebabcase
sourceRef: string.go#L190
category: core
subCategory: string
playUrl: https://go.dev/play/p/96gT_WZnTVP
playUrl: https://go.dev/play/p/ZBeMB4-pq45
variantHelpers:
- core#string#kebabcase
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: keyify
sourceRef: slice.go#L429
category: core
subCategory: slice
playUrl: https://go.dev/play/p/RYhhM_csqIG
playUrl: https://go.dev/play/p/_d5lXdzfw32
variantHelpers:
- core#slice#keyify
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: latest
sourceRef: find.go#L508
category: core
subCategory: find
playUrl:
playUrl: https://go.dev/play/p/dBfdf5s8s-Y
variantHelpers:
- core#find#latest
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: latestby
sourceRef: find.go#L530
category: core
subCategory: find
playUrl:
playUrl: https://go.dev/play/p/p1HA8XumaMU
variantHelpers:
- core#find#latestby
similarHelpers:
+1
View File
@@ -4,6 +4,7 @@ slug: latestbyerr
sourceRef: find.go#L737
category: core
subCategory: find
playUrl: https://go.dev/play/p/WpBUptwnxuG
signatures:
- "func LatestByErr[T any](collection []T, iteratee func(item T) (time.Time, error)) (T, error)"
variantHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: maptoslice
sourceRef: map.go#L367
category: core
subCategory: map
playUrl: https://go.dev/play/p/ZuiCZpDt6LD
playUrl: https://go.dev/play/p/4f5hbHyMf5h
variantHelpers:
- core#map#maptoslice
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: max
sourceRef: find.go#L410
category: core
subCategory: find
playUrl: https://go.dev/play/p/r6e-Z8JozS8
playUrl: https://go.dev/play/p/wYvG8gRRFw-
variantHelpers:
- core#find#max
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: maxby
sourceRef: find.go#L507
category: core
subCategory: find
playUrl: https://go.dev/play/p/JW1qu-ECwF7
playUrl: https://go.dev/play/p/PJCc-ThrwX1
variantHelpers:
- core#find#maxby
similarHelpers:
+1
View File
@@ -4,6 +4,7 @@ slug: maxbyerr
sourceRef: find.go#L528
category: core
subCategory: find
playUrl: https://go.dev/play/p/s-63-6_9zqM
variantHelpers:
- core#find#maxbyerr
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: maxindex
sourceRef: find.go#L432
category: core
subCategory: find
playUrl:
playUrl: https://go.dev/play/p/RFkB4Mzb1qt
variantHelpers:
- core#find#maxindex
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: maxindexby
sourceRef: find.go#L566
category: core
subCategory: find
playUrl: https://go.dev/play/p/uaUszc-c9QK
playUrl: https://go.dev/play/p/5yd4W7pe2QJ
variantHelpers:
- core#find#maxindexby
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: min
sourceRef: find.go#L265
category: core
subCategory: find
playUrl: https://go.dev/play/p/r6e-Z8JozS8
playUrl: https://go.dev/play/p/fJFLwpY8eMN
variantHelpers:
- core#find#min
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: minby
sourceRef: find.go#L329
category: core
subCategory: find
playUrl:
playUrl: https://go.dev/play/p/-B1PsrHVnfx
variantHelpers:
- core#find#minby
similarHelpers:
+1
View File
@@ -4,6 +4,7 @@ slug: minbyerr
sourceRef: find.go#L349
category: core
subCategory: find
playUrl: https://go.dev/play/p/nvDYGS8q895
variantHelpers:
- core#find#minbyerr
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: minindex
sourceRef: find.go#L287
category: core
subCategory: find
playUrl:
playUrl: https://go.dev/play/p/RxAidik4p50
variantHelpers:
- core#find#minindex
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: minindexby
sourceRef: find.go#L337
category: core
subCategory: find
playUrl:
playUrl: https://go.dev/play/p/zwwPRqWhnUY
variantHelpers:
- core#find#minindexby
similarHelpers:
+1
View File
@@ -4,6 +4,7 @@ slug: minindexbyerr
sourceRef: find.go#L404
category: core
subCategory: find
playUrl: https://go.dev/play/p/MUqi_NvTKM1
signatures:
- "func MinIndexByErr[T any](collection []T, comparison func(a T, b T) (bool, error)) (T, int, error)"
variantHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: mode
sourceRef: math.go#L149
category: core
subCategory: math
playUrl:
playUrl: https://go.dev/play/p/PbiviqnV5zX
variantHelpers:
- core#math#mode
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: newdebounce
sourceRef: retry.go#L54
category: core
subCategory: concurrency
playUrl: https://go.dev/play/p/mz32VMK2nqe
playUrl: https://go.dev/play/p/_IPY7ROzbMk
variantHelpers:
- core#concurrency#newdebounce
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: newdebounceby
sourceRef: retry.go#L137
category: core
subCategory: concurrency
playUrl: https://go.dev/play/p/d3Vpt6pxhY8
playUrl: https://go.dev/play/p/Izk7GEzZm2Q
variantHelpers:
- core#concurrency#newdebounceby
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: newtransaction
sourceRef: retry.go#L253
category: core
subCategory: concurrency
playUrl: https://go.dev/play/p/Qxrd7MGQGh1
playUrl: https://go.dev/play/p/7B2o52wEQbj
variantHelpers:
- core#concurrency#newtransaction
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: nth
sourceRef: find.go#L617
category: core
subCategory: find
playUrl: https://go.dev/play/p/sHoh88KWt6B
playUrl: https://go.dev/play/p/mNFI9-kIZZ5
variantHelpers:
- core#find#nth
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: nthor
sourceRef: find.go#L635
category: core
subCategory: find
playUrl: https://go.dev/play/p/sHoh88KWt6B
playUrl: https://go.dev/play/p/njKcNhBBVsF
variantHelpers:
- core#find#nthor
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: pascalcase
sourceRef: string.go#L166
category: core
subCategory: string
playUrl: https://go.dev/play/p/Dy_V_6DUYhe
playUrl: https://go.dev/play/p/uxER7XpRHLB
variantHelpers:
- core#string#pascalcase
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: pickbyvalues
sourceRef: map.go#L130
category: core
subCategory: map
playUrl: https://go.dev/play/p/1zdzSvbfsJc
playUrl: https://go.dev/play/p/-_PPkSbO1Kc
variantHelpers:
- core#map#pickbyvalues
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: range
sourceRef: math.go#L9
category: core
subCategory: math
playUrl: https://go.dev/play/p/0r6VimXAi9H
playUrl: https://go.dev/play/p/rho00R0WuHs
variantHelpers:
- core#math#range
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: core
subCategory: slice
signatures:
- "func RejectErr[T any, Slice ~[]T](collection Slice, predicate func(item T, index int) (bool, error)) (Slice, error)"
playUrl:
playUrl: https://go.dev/play/p/pFCF5WVB225
variantHelpers:
- core#slice#rejecterr
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: rejectmap
sourceRef: slice.go#L550
category: core
subCategory: slice
playUrl: https://go.dev/play/p/W9Ug9r0QFk
playUrl: https://go.dev/play/p/bmXhtuM2OMq
variantHelpers:
- core#slice#rejectmap
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: runelength
sourceRef: string.go#L160
category: core
subCategory: string
playUrl: https://go.dev/play/p/tuhgW_lWY8l
playUrl: https://go.dev/play/p/BXT52mBk0zO
variantHelpers:
- core#string#runelength
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: samples
sourceRef: find.go#L679
category: core
subCategory: find
playUrl: https://go.dev/play/p/vCcSJbh5s6l
playUrl: https://go.dev/play/p/QYRD8aufD0C
variantHelpers:
- core#find#samples
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: samplesby
sourceRef: find.go#L686
category: core
subCategory: find
playUrl: https://go.dev/play/p/HDmKmMgq0XN
playUrl: https://go.dev/play/p/Dy9bGDhD_Gw
variantHelpers:
- core#find#samplesby
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: shuffle
sourceRef: slice.go#L322
category: core
subCategory: slice
playUrl: https://go.dev/play/p/ZTGG7OUCdnp
playUrl: https://go.dev/play/p/whgrQWwOy-j
variantHelpers:
- core#slice#shuffle
similarHelpers:
+1
View File
@@ -6,6 +6,7 @@ category: core
subCategory: slice
variantHelpers:
- core#slice#sliding
playUrl: https://go.dev/play/p/aIIU6gWxl2T
similarHelpers:
- core#slice#window
- core#slice#chunk
+1 -1
View File
@@ -4,7 +4,7 @@ slug: substring
sourceRef: string.go#L105
category: core
subCategory: string
playUrl: https://go.dev/play/p/TQlxQi82Lu1
playUrl: https://go.dev/play/p/emzCC9zBjHu
variantHelpers:
- core#string#substring
similarHelpers:
+1
View File
@@ -6,6 +6,7 @@ category: core
subCategory: slice
variantHelpers:
- core#slice#takefilter
playUrl: https://go.dev/play/p/l99lvN4gReF
similarHelpers:
- core#slice#filter
- core#slice#take
+1
View File
@@ -6,6 +6,7 @@ category: core
subCategory: slice
variantHelpers:
- core#slice#takewhile
playUrl: https://go.dev/play/p/NJkLGvyRWm4
similarHelpers:
- core#slice#take
- core#slice#dropwhile
+1 -1
View File
@@ -4,7 +4,7 @@ slug: trim
sourceRef: slice.go#L842
category: core
subCategory: slice
playUrl: https://go.dev/play/p/1an9mxLdRG5
playUrl: https://go.dev/play/p/LZLfLj5C8Lg
variantHelpers:
- core#slice#trim
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: trimleft
sourceRef: slice.go#L847
category: core
subCategory: slice
playUrl: https://go.dev/play/p/74aqfAYLmyi
playUrl: https://go.dev/play/p/fJK-AhROy9w
variantHelpers:
- core#slice#trimleft
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: trimprefix
sourceRef: slice.go#L858
category: core
subCategory: slice
playUrl: https://go.dev/play/p/SHO6X-YegPg
playUrl: https://go.dev/play/p/8O2RoWYzi8J
variantHelpers:
- core#slice#trimprefix
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: trimright
sourceRef: slice.go#L873
category: core
subCategory: slice
playUrl: https://go.dev/play/p/MRpAfR6sf0g
playUrl: https://go.dev/play/p/9V_N8sRyyiZ
variantHelpers:
- core#slice#trimright
similarHelpers:
+1 -1
View File
@@ -13,7 +13,7 @@ signatures:
- "func Try4[T, R, S any](callback func() (T, R, S, error)) bool"
- "func Try5[T, R, S, Q any](callback func() (T, R, S, Q, error)) bool"
- "func Try6[T, R, S, Q, U any](callback func() (T, R, S, Q, U, error)) bool"
playUrl:
playUrl: https://go.dev/play/p/mTyyWUvn9u4
variantHelpers:
- core#error-handling#try
- core#error-handling#tryx
+1 -1
View File
@@ -4,7 +4,7 @@ slug: union
sourceRef: intersect.go#L157
category: core
subCategory: intersect
playUrl: https://go.dev/play/p/DI9RVEB_qMK
playUrl: https://go.dev/play/p/-hsqZNTH0ej
variantHelpers:
- core#intersect#union
similarHelpers:
+1
View File
@@ -13,6 +13,7 @@ signatures:
- "func UnzipByErr7[In any, A any, B any, C any, D any, E any, F any, G any](items []In, predicate func(In) (a A, b B, c C, d D, e E, f F, g G, err error)) ([]A, []B, []C, []D, []E, []F, []G, error)"
- "func UnzipByErr8[In any, A any, B any, C any, D any, E any, F any, G any, H any](items []In, predicate func(In) (a A, b B, c C, d D, e E, f F, g G, h H, err error)) ([]A, []B, []C, []D, []E, []F, []G, []H, error)"
- "func UnzipByErr9[In any, A any, B any, C any, D any, E any, F any, G any, H any, I any](items []In, predicate func(In) (a A, b B, c C, d D, e E, f F, g G, h H, i I, err error)) ([]A, []B, []C, []D, []E, []F, []G, []H, []I, error)"
playUrl: https://go.dev/play/p/G2pyXQa1SUD
variantHelpers:
- core#tuple#unzipbyerrx
similarHelpers:
+1 -1
View File
@@ -13,7 +13,7 @@ signatures:
- "func Unzip7[A, B, C, D, E, F, G any](tuples []Tuple7[A, B, C, D, E, F, G]) ([]A, []B, []C, []D, []E, []F, []G)"
- "func Unzip8[A, B, C, D, E, F, G, H any](tuples []Tuple8[A, B, C, D, E, F, G, H]) ([]A, []B, []C, []D, []E, []F, []G, []H)"
- "func Unzip9[A, B, C, D, E, F, G, H, I any](tuples []Tuple9[A, B, C, D, E, F, G, H, I]) ([]A, []B, []C, []D, []E, []F, []G, []H, []I)"
playUrl: https://go.dev/play/p/ciHugugvaAW
playUrl: https://go.dev/play/p/K-vG9tyD3Kf
variantHelpers:
- core#tuple#unzipx
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: without
sourceRef: intersect.go#L181
category: core
subCategory: intersect
playUrl: https://go.dev/play/p/5j30Ux8TaD0
playUrl: https://go.dev/play/p/PcAVtYJsEsS
variantHelpers:
- core#intersect#without
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: withoutempty
sourceRef: intersect.go#L218
category: core
subCategory: intersect
playUrl:
playUrl: https://go.dev/play/p/iZvYJWuniJm
variantHelpers:
- core#intersect#withoutempty
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: withoutnth
sourceRef: intersect.go#L223
category: core
subCategory: intersect
playUrl: https://go.dev/play/p/5g3F9R2H1xL
playUrl: https://go.dev/play/p/AIro-_UtL9c
variantHelpers:
- core#intersect#withoutnth
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: sequence
signatures:
- "func Buffer[T any](seq iter.Seq[T], size int) iter.Seq[[]T]"
playUrl: ""
playUrl: https://go.dev/play/p/zDZdcCA20ut
variantHelpers:
- it#sequence#buffer
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: sequence
signatures:
- "func Chunk[T any](collection iter.Seq[T], size int) iter.Seq[[]T]"
playUrl: "https://go.dev/play/p/4VpIM8-zu"
playUrl: https://go.dev/play/p/qo8esZ_L60Q
variantHelpers:
- it#sequence#chunk
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: chunkstring
sourceRef: it/string.go#L130
category: it
subCategory: string
playUrl: "https://go.dev/play/p/Y4mN8bB2cXw"
playUrl: "https://go.dev/play/p/Bcc5ixTQQoQ"
variantHelpers:
- it#string#chunkstring
similarHelpers:
+1 -1
View File
@@ -4,7 +4,7 @@ slug: concat
sourceRef: it/seq.go#L358
category: it
subCategory: sequence
playUrl:
playUrl: https://go.dev/play/p/Fa0u7xT2JOR
variantHelpers:
- it#sequence#concat
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: intersect
signatures:
- "func ContainsBy[T any](collection iter.Seq[T], predicate func(item T) bool) bool"
playUrl: "https://go.dev/play/p/2edj7hH3TS2"
playUrl: https://go.dev/play/p/m86Cpsoyv8k
variantHelpers:
- it#intersect#containsby
similarHelpers:
+1 -1
View File
@@ -7,7 +7,7 @@ subCategory: sequence
signatures:
- "func Count[T comparable](collection iter.Seq[T], value T) int"
- "func CountBy[T any](collection iter.Seq[T], predicate func(item T) bool) int"
playUrl: "https://go.dev/play/p/1SmFJ5-zr"
playUrl: https://go.dev/play/p/UcJ-6cANwfY
variantHelpers:
- it#sequence#count
- it#sequence#countby
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: find
signatures:
- "func CountBy[T any](collection iter.Seq[T], predicate func(item T) bool) int"
playUrl:
playUrl: https://go.dev/play/p/m6G0o3huCOG
variantHelpers:
- it#find#count
similarHelpers:
+1
View File
@@ -6,6 +6,7 @@ category: it
subCategory: slice
signatures:
- "func CountValues[T comparable](collection iter.Seq[T]) map[T]int"
playUrl: https://go.dev/play/p/PPBT4Fp-V3B
variantHelpers: []
similarHelpers:
- core#slice#countvalues
+1
View File
@@ -6,6 +6,7 @@ category: it
subCategory: slice
signatures:
- "func CountValuesBy[T any, U comparable](collection iter.Seq[T], transform func(item T) U) map[U]int"
playUrl: https://go.dev/play/p/gnr_MPhYCHX
variantHelpers: []
similarHelpers:
- core#slice#countvaluesby
+1 -1
View File
@@ -13,7 +13,7 @@ signatures:
- "func CrossJoinBy7[T1, T2, T3, T4, T5, T6, T7, R any](seq1 iter.Seq[T1], seq2 iter.Seq[T2], seq3 iter.Seq[T3], seq4 iter.Seq[T4], seq5 iter.Seq[T5], seq6 iter.Seq[T6], seq7 iter.Seq[T7], transform func(T1, T2, T3, T4, T5, T6, T7) R) iter.Seq[R]"
- "func CrossJoinBy8[T1, T2, T3, T4, T5, T6, T7, T8, R any](seq1 iter.Seq[T1], seq2 iter.Seq[T2], seq3 iter.Seq[T3], seq4 iter.Seq[T4], seq5 iter.Seq[T5], seq6 iter.Seq[T6], seq7 iter.Seq[T7], seq8 iter.Seq[T8], transform func(T1, T2, T3, T4, T5, T6, T7, T8) R) iter.Seq[R]"
- "func CrossJoinBy9[T1, T2, T3, T4, T5, T6, T7, T8, T9, R any](seq1 iter.Seq[T1], seq2 iter.Seq[T2], seq3 iter.Seq[T3], seq4 iter.Seq[T4], seq5 iter.Seq[T5], seq6 iter.Seq[T6], seq7 iter.Seq[T7], seq8 iter.Seq[T8], seq9 iter.Seq[T9], transform func(T1, T2, T3, T4, T5, T6, T7, T8, T9) R) iter.Seq[R]"
playUrl: "https://go.dev/play/p/3XrQKOk-vw"
playUrl: https://go.dev/play/p/6QGp3W-bQU1
variantHelpers:
- it#tuple#crossjoinbyx
similarHelpers:
+1 -1
View File
@@ -13,7 +13,7 @@ signatures:
- "func CrossJoin7[T1, T2, T3, T4, T5, T6, T7 any](list1 iter.Seq[T1], list2 iter.Seq[T2], list3 iter.Seq[T3], list4 iter.Seq[T4], list5 iter.Seq[T5], list6 iter.Seq[T6], list7 iter.Seq[T7]) iter.Seq[lo.Tuple7[T1, T2, T3, T4, T5, T6, T7]]"
- "func CrossJoin8[T1, T2, T3, T4, T5, T6, T7, T8 any](list1 iter.Seq[T1], list2 iter.Seq[T2], list3 iter.Seq[T3], list4 iter.Seq[T4], list5 iter.Seq[T5], list6 iter.Seq[T6], list7 iter.Seq[T7], list8 iter.Seq[T8]) iter.Seq[lo.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]"
- "func CrossJoin9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any](list1 iter.Seq[T1], list2 iter.Seq[T2], list3 iter.Seq[T3], list4 iter.Seq[T4], list5 iter.Seq[T5], list6 iter.Seq[T6], list7 iter.Seq[T7], list8 iter.Seq[T8], list9 iter.Seq[T9]) iter.Seq[lo.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]"
playUrl: "https://go.dev/play/p/4XrQKOk-vw"
playUrl: https://go.dev/play/p/OFe8xjZFjWU
variantHelpers:
- it#tuple#crossjoinx
similarHelpers:
+1
View File
@@ -6,6 +6,7 @@ category: it
subCategory: string
signatures:
- "func CutPrefix[T comparable, I ~func(func(T) bool)](collection I, separator []T) (after I, found bool)"
playUrl: https://go.dev/play/p/bPnV39zVnAV
variantHelpers: []
similarHelpers:
- core#string#cutprefix
+1
View File
@@ -6,6 +6,7 @@ category: it
subCategory: string
signatures:
- "func CutSuffix[T comparable, I ~func(func(T) bool)](collection I, separator []T) (before I, found bool)"
playUrl: https://go.dev/play/p/CTRh9m1UHrZ
variantHelpers: []
similarHelpers:
- core#string#cutsuffix
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: sequence
signatures:
- "func Drain[T any](collection iter.Seq[T])"
playUrl: "https://go.dev/play/p/4eocpKucL-p"
playUrl: https://go.dev/play/p/xU_GCG861r1
variantHelpers: []
similarHelpers: []
position: 170
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: sequence
signatures:
- "func Drop[T any, I ~func(func(T) bool)](collection I, n int) I"
playUrl: "https://go.dev/play/p/1SmFJ5-zr"
playUrl: https://go.dev/play/p/O1J1-uWc3z9
variantHelpers:
- it#sequence#drop
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: sequence
signatures:
- "func DropByIndex[T any, I ~func(func(T) bool)](collection I, indexes ...int) I"
playUrl:
playUrl: https://go.dev/play/p/vPbrZYgiU4q
variantHelpers:
- it#slice#drop
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: find
signatures:
- "func Earliest(times iter.Seq[time.Time]) time.Time"
playUrl: "https://go.dev/play/p/7EyYRV1-zd"
playUrl: https://go.dev/play/p/fI6_S10H7Py
variantHelpers:
- it#find#earliest
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: find
signatures:
- "func EarliestBy[T any](collection iter.Seq[T], transform func(item T) time.Time) T"
playUrl: "https://go.dev/play/p/8FzSW2-ze"
playUrl: https://go.dev/play/p/y_Pf3Jmw-B4
variantHelpers:
- it#find#earliestby
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: intersect
signatures:
- "func ElementsMatch[T comparable](list1, list2 iter.Seq[T]) bool"
playUrl: "https://go.dev/play/p/yGpdBGaWPCA"
playUrl: "https://go.dev/play/p/24SGQm1yMRe"
variantHelpers:
- it#intersect#elementsmatch
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: intersect
signatures:
- "func ElementsMatchBy[T any, K comparable](list1, list2 iter.Seq[T], transform func(item T) K) bool"
playUrl: "https://go.dev/play/p/5XrQKOk-vw"
playUrl: "https://go.dev/play/p/I3vFrmQo43E"
variantHelpers:
- it#intersect#elementsmatchby
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: map
signatures:
- "func Entries[K comparable, V any](in ...map[K]V) iter.Seq2[K, V]"
playUrl: "https://go.dev/play/p/N8RbJ5t6H2k"
playUrl: https://go.dev/play/p/ckLxqTE9KCz
variantHelpers:
- it#map#entries
similarHelpers:
+1 -1
View File
@@ -6,7 +6,7 @@ category: it
subCategory: intersect
signatures:
- "func EveryBy[T any](collection iter.Seq[T], predicate func(item T) bool) bool"
playUrl: "https://go.dev/play/p/3edj7hH3TS2"
playUrl: https://go.dev/play/p/7OvV1BRWsER
variantHelpers:
- it#intersect#everyby
similarHelpers:

Some files were not shown because too many files have changed in this diff Show More