-
-
Notifications
You must be signed in to change notification settings - Fork 933
Open
Labels
breaking changeIntroduces changes that break backward compatibility or alter the public API.Introduces changes that break backward compatibility or alter the public API.bugSomething isn't working as expectedSomething isn't working as expected
Milestone
Description
Description
ChunkString and Chunk have inconsistent behavior when handling empty inputs:
Chunk([]rune{}, 1)returns[](empty slice)ChunkString("", 1)returns[""](slice with one empty string)
Expected Behavior
Both functions should return empty collections for empty inputs. ChunkString("", 1) should return [] for consistency with Chunk.
Actual Behavior
package main
import (
"fmt"
"github.com/samber/lo"
)
func main() {
// Chunk returns empty slice
fmt.Printf("Chunk([]rune{}, 1) = %q\n", lo.Chunk([]rune{}, 1))
// Output: Chunk([]rune{}, 1) = []
// ChunkString returns slice with empty string
fmt.Printf(`ChunkString("", 1) = %q`, lo.ChunkString("", 1))
// Output: ChunkString("", 1) = [""]
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changeIntroduces changes that break backward compatibility or alter the public API.Introduces changes that break backward compatibility or alter the public API.bugSomething isn't working as expectedSomething isn't working as expected