Compare commits

..

13 Commits

Author SHA1 Message Date
semantic-release-bot
9053afe0f5 release(rc): v0.1.2-rc.3
## [0.1.2-rc.3](https://git.ext.icikowski.pl/go/collections/compare/v0.1.2-rc.2...v0.1.2-rc.3) (2024-08-20)

### Build system and dependencies

* **deps:** update all non-major dependencies ([1889343](18893430b2))
2024-08-20 21:18:22 +00:00
18893430b2 build(deps): update all non-major dependencies
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
2024-08-20 21:14:50 +00:00
semantic-release-bot
4e24f0b13b release(rc): v0.1.2-rc.2
## [0.1.2-rc.2](https://git.ext.icikowski.pl/go/collections/compare/v0.1.2-rc.1...v0.1.2-rc.2) (2024-08-20)

### Build system and dependencies

* **deps:** update all non-major dependencies ([03c43e3](03c43e3b9c))
2024-08-20 20:49:20 +00:00
03c43e3b9c
build(deps): update all non-major dependencies
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
2024-08-20 22:48:33 +02:00
semantic-release-bot
872fab3131 release(rc): v0.1.2-rc.1
## [0.1.2-rc.1](https://git.ext.icikowski.pl/go/collections/compare/v0.1.1...v0.1.2-rc.1) (2024-08-20)

### Build system and dependencies

* **deps:** update all major dependencies ([eeb58c3](eeb58c3ed8))
2024-08-20 20:39:29 +00:00
eeb58c3ed8 build(deps): update all major dependencies
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
2024-06-01 00:02:04 +00:00
semantic-release-bot
f2da0244d8 release(stable): v0.1.1
## [0.1.1](https://git.ext.icikowski.pl/go/collections/compare/v0.1.0...v0.1.1) (2024-05-27)

### Refactoring

* **comments:** beautify comments ([b3d5fbf](b3d5fbf332))
* **tests:** move `person` type to test function ([c0fb09e](c0fb09e573))

###  Tests

* **fixtures:** embed test fixtures ([563848c](563848c2fb))

### Continuous Integrations

* **deps:** pin `conventional-changelog-conventionalcommits` to version 7.x ([739f469](739f469fbd))
* **init:** add initial CI configuration ([adbb987](adbb987cbd))
* **renovate:** add Renovate bot configuration ([d831943](d831943b12))
* **test:** remove `group` directive ([78b8b10](78b8b10998))

### Build system and dependencies

* **deps:** update all non-major dependencies ([45caf52](45caf527e5))
* **deps:** update all non-major dependencies ([4535c6a](4535c6a712))
* **deps:** update dependency @semantic-release/commit-analyzer to v12 ([753965d](753965d7d7))
* **deps:** update dependency @semantic-release/npm to v11.0.3 ([21a7e54](21a7e54167))
* **deps:** update dependency @semantic-release/npm to v12 ([8ab3f7a](8ab3f7a261))
* **deps:** update dependency @semantic-release/release-notes-generator to v13 ([7de8723](7de8723b78))
* **deps:** update dependency conventional-changelog-conventionalcommits to v8 ([c735657](c735657b03))
* **deps:** update dependency semantic-release to v23 ([cc414e0](cc414e0bd8))
* **deps:** update dependency semantic-release to v23.0.3 ([6a678d4](6a678d45ca))
* **deps:** update dependency semantic-release to v23.0.4 ([cb21cd1](cb21cd13f5))
* **deps:** update dependency semantic-release to v23.0.5 ([9994912](9994912f87))
* **deps:** update dependency semantic-release to v23.0.8 ([489048c](489048c232))
* **deps:** update project dependencies ([210cb07](210cb07c17))
2024-05-27 23:38:11 +00:00
semantic-release-bot
ccd10395e9 release(rc): v0.1.1-rc.11
All checks were successful
ci/woodpecker/push/release Pipeline was successful
## [0.1.1-rc.11](https://git.ext.icikowski.pl/go/collections/compare/v0.1.1-rc.10...v0.1.1-rc.11) (2024-05-27)

### Refactoring

* **comments:** beautify comments ([b3d5fbf](b3d5fbf332))
* **tests:** move `person` type to test function ([c0fb09e](c0fb09e573))

### Continuous Integrations

* **test:** remove `group` directive ([78b8b10](78b8b10998))

### Build system and dependencies

* **deps:** update project dependencies ([210cb07](210cb07c17))
2024-05-27 23:36:50 +00:00
134fdfdfd7
docs(package): add simple README.md and package descriptions
All checks were successful
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
2024-05-28 01:35:57 +02:00
210cb07c17
build(deps): update project dependencies 2024-05-28 01:31:49 +02:00
c0fb09e573
refactor(tests): move person type to test function 2024-05-28 01:30:00 +02:00
b3d5fbf332
refactor(comments): beautify comments 2024-05-28 01:28:25 +02:00
78b8b10998
ci(test): remove group directive 2024-05-28 01:11:23 +02:00
17 changed files with 240 additions and 233 deletions

View File

@ -5,7 +5,6 @@ when:
steps: steps:
test: test:
group: test image: golang:1.23-alpine
image: golang:1.22-alpine
commands: commands:
- go test -v ./... - go test -v ./...

View File

@ -1,3 +1,77 @@
## [0.1.2-rc.3](https://git.ext.icikowski.pl/go/collections/compare/v0.1.2-rc.2...v0.1.2-rc.3) (2024-08-20)
### Build system and dependencies
* **deps:** update all non-major dependencies ([1889343](https://git.ext.icikowski.pl/go/collections/commit/18893430b2509470b8743da17f56e916f2166a43))
## [0.1.2-rc.2](https://git.ext.icikowski.pl/go/collections/compare/v0.1.2-rc.1...v0.1.2-rc.2) (2024-08-20)
### Build system and dependencies
* **deps:** update all non-major dependencies ([03c43e3](https://git.ext.icikowski.pl/go/collections/commit/03c43e3b9c2cf4469efd646b30cbba257786bdef))
## [0.1.2-rc.1](https://git.ext.icikowski.pl/go/collections/compare/v0.1.1...v0.1.2-rc.1) (2024-08-20)
### Build system and dependencies
* **deps:** update all major dependencies ([eeb58c3](https://git.ext.icikowski.pl/go/collections/commit/eeb58c3ed84fe1cc68b03d0ce4ead5cc8168fad7))
## [0.1.1](https://git.ext.icikowski.pl/go/collections/compare/v0.1.0...v0.1.1) (2024-05-27)
### Refactoring
* **comments:** beautify comments ([b3d5fbf](https://git.ext.icikowski.pl/go/collections/commit/b3d5fbf332089a5f50ec09af06bfcde627984955))
* **tests:** move `person` type to test function ([c0fb09e](https://git.ext.icikowski.pl/go/collections/commit/c0fb09e573c7cdb9a630d15e21e2eb61718a1060))
### Tests
* **fixtures:** embed test fixtures ([563848c](https://git.ext.icikowski.pl/go/collections/commit/563848c2fb94637046a3c87e7717ec960f546154))
### Continuous Integrations
* **deps:** pin `conventional-changelog-conventionalcommits` to version 7.x ([739f469](https://git.ext.icikowski.pl/go/collections/commit/739f469fbd891866529b9a8acf21a42b6a3d1c7e))
* **init:** add initial CI configuration ([adbb987](https://git.ext.icikowski.pl/go/collections/commit/adbb987cbd01b21b4b09c7a75801d90f7941fbc7))
* **renovate:** add Renovate bot configuration ([d831943](https://git.ext.icikowski.pl/go/collections/commit/d831943b121bb91ec53c2bc8a269eade81b76047))
* **test:** remove `group` directive ([78b8b10](https://git.ext.icikowski.pl/go/collections/commit/78b8b109987da0d1f769e06b7a0794077a75865d))
### Build system and dependencies
* **deps:** update all non-major dependencies ([45caf52](https://git.ext.icikowski.pl/go/collections/commit/45caf527e51ea272f2351d2f35d12af4030c0678))
* **deps:** update all non-major dependencies ([4535c6a](https://git.ext.icikowski.pl/go/collections/commit/4535c6a712833eb0d931f67040233ab690561fc3))
* **deps:** update dependency @semantic-release/commit-analyzer to v12 ([753965d](https://git.ext.icikowski.pl/go/collections/commit/753965d7d7fdc9c0a017fa772899c51f4fe0e0f4))
* **deps:** update dependency @semantic-release/npm to v11.0.3 ([21a7e54](https://git.ext.icikowski.pl/go/collections/commit/21a7e541676f7afe799a6d86d1bb0709e070a6ab))
* **deps:** update dependency @semantic-release/npm to v12 ([8ab3f7a](https://git.ext.icikowski.pl/go/collections/commit/8ab3f7a261d6781598d07a45bcaa245379fccb47))
* **deps:** update dependency @semantic-release/release-notes-generator to v13 ([7de8723](https://git.ext.icikowski.pl/go/collections/commit/7de8723b78db006cbad135139526941cb621f912))
* **deps:** update dependency conventional-changelog-conventionalcommits to v8 ([c735657](https://git.ext.icikowski.pl/go/collections/commit/c735657b0364fd68656ee89756193fe52a5030ad))
* **deps:** update dependency semantic-release to v23 ([cc414e0](https://git.ext.icikowski.pl/go/collections/commit/cc414e0bd87979ca39a0fb799c76802a887cd82f))
* **deps:** update dependency semantic-release to v23.0.3 ([6a678d4](https://git.ext.icikowski.pl/go/collections/commit/6a678d45cabe8d20708f8b46e3087402a6d53123))
* **deps:** update dependency semantic-release to v23.0.4 ([cb21cd1](https://git.ext.icikowski.pl/go/collections/commit/cb21cd13f59139644fcdeae127e89a9bf3e6b624))
* **deps:** update dependency semantic-release to v23.0.5 ([9994912](https://git.ext.icikowski.pl/go/collections/commit/9994912f870ed00b8d97bae72af10e5ad532ace0))
* **deps:** update dependency semantic-release to v23.0.8 ([489048c](https://git.ext.icikowski.pl/go/collections/commit/489048c23261cc5c61d73f6d62dbc112b41c798f))
* **deps:** update project dependencies ([210cb07](https://git.ext.icikowski.pl/go/collections/commit/210cb07c178c727a618018f61c80b9a6aee54701))
## [0.1.1-rc.11](https://git.ext.icikowski.pl/go/collections/compare/v0.1.1-rc.10...v0.1.1-rc.11) (2024-05-27)
### Refactoring
* **comments:** beautify comments ([b3d5fbf](https://git.ext.icikowski.pl/go/collections/commit/b3d5fbf332089a5f50ec09af06bfcde627984955))
* **tests:** move `person` type to test function ([c0fb09e](https://git.ext.icikowski.pl/go/collections/commit/c0fb09e573c7cdb9a630d15e21e2eb61718a1060))
### Continuous Integrations
* **test:** remove `group` directive ([78b8b10](https://git.ext.icikowski.pl/go/collections/commit/78b8b109987da0d1f769e06b7a0794077a75865d))
### Build system and dependencies
* **deps:** update project dependencies ([210cb07](https://git.ext.icikowski.pl/go/collections/commit/210cb07c178c727a618018f61c80b9a6aee54701))
## [0.1.1-rc.10](https://git.ext.icikowski.pl/go/collections/compare/v0.1.1-rc.9...v0.1.1-rc.10) (2024-05-21) ## [0.1.1-rc.10](https://git.ext.icikowski.pl/go/collections/compare/v0.1.1-rc.9...v0.1.1-rc.10) (2024-05-21)

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# `collections`
[![Go Report Card](https://goreportcard.com/badge/pkg.icikowski.pl/collections)](https://goreportcard.com/report/pkg.icikowski.pl/collections)
Collections and stream-like operations for Go.

View File

@ -9,7 +9,7 @@ import (
"pkg.icikowski.pl/collections/functions" "pkg.icikowski.pl/collections/functions"
) )
// Collection represents the collection of data // Collection represents the collection of data.
// //
// By default, the collection uses parallel implementation of operators. // By default, the collection uses parallel implementation of operators.
type Collection[T any] struct { type Collection[T any] struct {
@ -17,23 +17,23 @@ type Collection[T any] struct {
parallel bool parallel bool
} }
// Count counts values in the collection // Count counts values in the collection.
func (s *Collection[T]) Count() int { func (s *Collection[T]) Count() int {
return len(s.data) return len(s.data)
} }
// Epty determines whether the collection is empty // Epty determines whether the collection is empty.
func (s *Collection[T]) Empty() bool { func (s *Collection[T]) Empty() bool {
return len(s.data) == 0 return len(s.data) == 0
} }
// Parallel sets the collection to use parallel implementation of operators // Parallel sets the collection to use parallel implementation of operators.
func (s *Collection[T]) Parallel() *Collection[T] { func (s *Collection[T]) Parallel() *Collection[T] {
s.parallel = true s.parallel = true
return s return s
} }
// Sequential sets the collection to use sequential implementation of operators // Sequential sets the collection to use sequential implementation of operators.
func (s *Collection[T]) Sequential() *Collection[T] { func (s *Collection[T]) Sequential() *Collection[T] {
s.parallel = false s.parallel = false
return s return s
@ -73,7 +73,7 @@ func (s *Collection[T]) filterSequential(p functions.Predicate[T]) *Collection[T
return s return s
} }
// Filter filters the collection using given [functions.Predicate] // Filter filters the collection using given [functions.Predicate].
func (s *Collection[T]) Filter(p functions.Predicate[T]) *Collection[T] { func (s *Collection[T]) Filter(p functions.Predicate[T]) *Collection[T] {
if s.parallel { if s.parallel {
return s.filterParallel(p) return s.filterParallel(p)
@ -113,7 +113,7 @@ func (s *Collection[T]) allMatchSequential(p functions.Predicate[T]) bool {
return true return true
} }
// AllMatch checks whether all elements in collection match given [functions.Predicate] // AllMatch checks whether all elements in collection match given [functions.Predicate].
func (s *Collection[T]) AllMatch(p functions.Predicate[T]) bool { func (s *Collection[T]) AllMatch(p functions.Predicate[T]) bool {
if s.parallel { if s.parallel {
return s.allMatchParallel(p) return s.allMatchParallel(p)
@ -153,7 +153,7 @@ func (s *Collection[T]) anyMatchSequential(p functions.Predicate[T]) bool {
return false return false
} }
// AnyMatch checks whether any elements in collection match given [functions.Predicate] // AnyMatch checks whether any elements in collection match given [functions.Predicate].
func (s *Collection[T]) AnyMatch(p functions.Predicate[T]) bool { func (s *Collection[T]) AnyMatch(p functions.Predicate[T]) bool {
if s.parallel { if s.parallel {
return s.anyMatchParallel(p) return s.anyMatchParallel(p)
@ -193,7 +193,7 @@ func (s *Collection[T]) noneMatchSequential(p functions.Predicate[T]) bool {
return true return true
} }
// NoneMatch checks whether no elements in collection match given [functions.Predicate] // NoneMatch checks whether no elements in collection match given [functions.Predicate].
func (s *Collection[T]) NoneMatch(p functions.Predicate[T]) bool { func (s *Collection[T]) NoneMatch(p functions.Predicate[T]) bool {
if s.parallel { if s.parallel {
return s.noneMatchParallel(p) return s.noneMatchParallel(p)
@ -201,7 +201,7 @@ func (s *Collection[T]) NoneMatch(p functions.Predicate[T]) bool {
return s.noneMatchSequential(p) return s.noneMatchSequential(p)
} }
// Sorted sorts the collection using given [functions.Comparator] // Sorted sorts the collection using given [functions.Comparator].
func (s *Collection[T]) Sorted(c functions.Comparator[T]) *Collection[T] { func (s *Collection[T]) Sorted(c functions.Comparator[T]) *Collection[T] {
sort.SliceStable(s.data, func(i, j int) bool { sort.SliceStable(s.data, func(i, j int) bool {
return c(s.data[i], s.data[j]) return c(s.data[i], s.data[j])
@ -232,7 +232,7 @@ func (s *Collection[T]) peekSequential(c functions.Consumer[T]) *Collection[T] {
return s return s
} }
// Peek executes given [function.Consumer] on every value in collections // Peek executes given [function.Consumer] on every value in collections.
func (s *Collection[T]) Peek(c functions.Consumer[T]) *Collection[T] { func (s *Collection[T]) Peek(c functions.Consumer[T]) *Collection[T] {
if s.parallel { if s.parallel {
return s.peekParallel(c) return s.peekParallel(c)
@ -267,7 +267,7 @@ func (s *Collection[T]) transformSequential(u functions.UnaryOperator[T]) *Colle
return s return s
} }
// Transform transforms all values in collection using given [functions.UnaryOperator] // Transform transforms all values in collection using given [functions.UnaryOperator].
func (s *Collection[T]) Transform(u functions.UnaryOperator[T]) *Collection[T] { func (s *Collection[T]) Transform(u functions.UnaryOperator[T]) *Collection[T] {
if s.parallel { if s.parallel {
return s.transformParallel(u) return s.transformParallel(u)
@ -275,7 +275,7 @@ func (s *Collection[T]) Transform(u functions.UnaryOperator[T]) *Collection[T] {
return s.transformSequential(u) return s.transformSequential(u)
} }
// Reduce reduces values in given collection using given [functions.BinaryOperator] // Reduce reduces values in given collection using given [functions.BinaryOperator].
func (s *Collection[T]) Reduce(b functions.BinaryOperator[T]) T { func (s *Collection[T]) Reduce(b functions.BinaryOperator[T]) T {
processed := *new(T) processed := *new(T)
if len(s.data) == 0 { if len(s.data) == 0 {
@ -288,7 +288,7 @@ func (s *Collection[T]) Reduce(b functions.BinaryOperator[T]) T {
return processed return processed
} }
// Limit limits the collection to given number of values // Limit limits the collection to given number of values.
func (s *Collection[T]) Limit(n int) *Collection[T] { func (s *Collection[T]) Limit(n int) *Collection[T] {
if len(s.data) < n { if len(s.data) < n {
return s return s
@ -302,7 +302,7 @@ func (s *Collection[T]) Limit(n int) *Collection[T] {
return s return s
} }
// Skip skips given number of values in the collection // Skip skips given number of values in the collection.
func (s *Collection[T]) Skip(n int) *Collection[T] { func (s *Collection[T]) Skip(n int) *Collection[T] {
if len(s.data) == 0 { if len(s.data) == 0 {
return s return s
@ -316,7 +316,7 @@ func (s *Collection[T]) Skip(n int) *Collection[T] {
return s return s
} }
// FindFirst returns [Optional] with first item of the collection // FindFirst returns [Optional] with first item of the collection.
func (s *Collection[T]) FindFirst() *Optional[T] { func (s *Collection[T]) FindFirst() *Optional[T] {
e, present := *new(T), false e, present := *new(T), false
if len(s.data) != 0 { if len(s.data) != 0 {
@ -325,7 +325,7 @@ func (s *Collection[T]) FindFirst() *Optional[T] {
return &Optional[T]{e, present} return &Optional[T]{e, present}
} }
// FindFirst returns [Optional] with last item of the collection // FindFirst returns [Optional] with last item of the collection.
func (s *Collection[T]) FindLast() *Optional[T] { func (s *Collection[T]) FindLast() *Optional[T] {
e, present := *new(T), false e, present := *new(T), false
if len(s.data) != 0 { if len(s.data) != 0 {
@ -334,17 +334,17 @@ func (s *Collection[T]) FindLast() *Optional[T] {
return &Optional[T]{e, present} return &Optional[T]{e, present}
} }
// Min returns the lowest value from the collection using given [functions.Comparator] // Min returns the lowest value from the collection using given [functions.Comparator].
func (s *Collection[T]) Min(c functions.Comparator[T]) *Optional[T] { func (s *Collection[T]) Min(c functions.Comparator[T]) *Optional[T] {
return s.Sorted(c).FindFirst() return s.Sorted(c).FindFirst()
} }
// Max returns the highest value from the collection using given [functions.Comparator] // Max returns the highest value from the collection using given [functions.Comparator].
func (s *Collection[T]) Max(c functions.Comparator[T]) *Optional[T] { func (s *Collection[T]) Max(c functions.Comparator[T]) *Optional[T] {
return s.Sorted(c).FindLast() return s.Sorted(c).FindLast()
} }
// Distinct ensures that all elements in the collecion are unique // Distinct ensures that all elements in the collecion are unique.
func (s *Collection[T]) Distinct() *Collection[T] { func (s *Collection[T]) Distinct() *Collection[T] {
processed := []T{} processed := []T{}
for i := 0; i < len(s.data); i++ { for i := 0; i < len(s.data); i++ {
@ -363,7 +363,7 @@ func (s *Collection[T]) Distinct() *Collection[T] {
return s return s
} }
// MapCollection maps collection of values of type T to collection of values of type U using given [functions.Function] // MapCollection maps collection of values of type T to collection of values of type U using given [functions.Function].
func MapCollection[T, U any](src *Collection[T], mapper functions.Function[T, U]) *Collection[U] { func MapCollection[T, U any](src *Collection[T], mapper functions.Function[T, U]) *Collection[U] {
data := []U{} data := []U{}
for _, e := range src.data { for _, e := range src.data {
@ -372,7 +372,7 @@ func MapCollection[T, U any](src *Collection[T], mapper functions.Function[T, U]
return &Collection[U]{data, src.parallel} return &Collection[U]{data, src.parallel}
} }
// Collect returns all items from collection as a slice // Collect returns all items from collection as a slice.
func (s *Collection[T]) Collect() []T { func (s *Collection[T]) Collect() []T {
return s.data return s.data
} }

View File

@ -13,14 +13,14 @@ import (
//go:embed collection_test.csv //go:embed collection_test.csv
var testData []byte var testData []byte
type person struct { func TestCollection(t *testing.T) {
type person struct {
ID int ID int
LastName string LastName string
FirstName string FirstName string
Email string Email string
} }
func TestCollection(t *testing.T) {
data := strings.Split(string(testData), "\n") data := strings.Split(string(testData), "\n")
lines := OfSlice(data).Skip(1).Filter(func(s string) bool { lines := OfSlice(data).Skip(1).Filter(func(s string) bool {

View File

@ -2,7 +2,7 @@ package comparators
import "pkg.icikowski.pl/collections/functions" import "pkg.icikowski.pl/collections/functions"
// CompareNumeric returns comparator for numeric values // CompareNumeric returns comparator for numeric values.
func CompareNumeric[T ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64]() functions.Comparator[T] { func CompareNumeric[T ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64]() functions.Comparator[T] {
return func(a, b T) bool { return func(a, b T) bool {
return a < b return a < b

View File

@ -1,4 +1,4 @@
/* /*
Handy comparators Handy comparators.
*/ */
package comparators package comparators

View File

@ -6,7 +6,7 @@ import (
"pkg.icikowski.pl/collections/functions" "pkg.icikowski.pl/collections/functions"
) )
// CompareString returns [functions.Comparator] for string values in given language // CompareString returns [functions.Comparator] for string values in given language.
func CompareString(lang language.Tag) functions.Comparator[string] { func CompareString(lang language.Tag) functions.Comparator[string] {
c := collate.New(lang) c := collate.New(lang)
return func(a, b string) bool { return func(a, b string) bool {

View File

@ -2,17 +2,17 @@ package collections
import "pkg.icikowski.pl/collections/functions" import "pkg.icikowski.pl/collections/functions"
// Of creates [Collection] of given items // Of creates [Collection] of given items.
func Of[T any](data ...T) *Collection[T] { func Of[T any](data ...T) *Collection[T] {
return &Collection[T]{data, true} return &Collection[T]{data, true}
} }
// OfSlice creates [Collection] of given slice elements // OfSlice creates [Collection] of given slice elements.
func OfSlice[T any](data []T) *Collection[T] { func OfSlice[T any](data []T) *Collection[T] {
return &Collection[T]{data, true} return &Collection[T]{data, true}
} }
// Iterate creates [Collection] of given number of items generated from given seed and [functions.UnaryOperator] // Iterate creates [Collection] of given number of items generated from given seed and [functions.UnaryOperator].
func Iterate[T any](seed T, u functions.UnaryOperator[T], limit int) *Collection[T] { func Iterate[T any](seed T, u functions.UnaryOperator[T], limit int) *Collection[T] {
if limit <= 0 { if limit <= 0 {
limit = 1 limit = 1
@ -25,7 +25,7 @@ func Iterate[T any](seed T, u functions.UnaryOperator[T], limit int) *Collection
return &Collection[T]{data, true} return &Collection[T]{data, true}
} }
// Generate creates [Collection] of given number of items generated from given [functions.Supplier] // Generate creates [Collection] of given number of items generated from given [functions.Supplier].
func Generate[T any](p functions.Supplier[T], limit int) *Collection[T] { func Generate[T any](p functions.Supplier[T], limit int) *Collection[T] {
if limit < 0 { if limit < 0 {
limit = 0 limit = 0

View File

@ -1,4 +1,4 @@
/* /*
Function types Function types.
*/ */
package functions package functions

View File

@ -1,24 +1,24 @@
package functions package functions
type ( type (
// Consumer takes an argument of type T and returns nothing // Consumer takes an argument of type T and returns nothing.
Consumer[T any] func(T) Consumer[T any] func(T)
// Function takes an argument of type T and returns a result of type U // Function takes an argument of type T and returns a result of type U.
Function[T, U any] func(T) U Function[T, U any] func(T) U
// Predicate takes an argument of type T and returns a boolean result // Predicate takes an argument of type T and returns a boolean result.
Predicate[T any] func(T) bool Predicate[T any] func(T) bool
// Supplier takes no argument and returns a result of type T // Supplier takes no argument and returns a result of type T.
Supplier[T any] func() T Supplier[T any] func() T
// UnaryOperator takes an argument of type T and returns a result of type T // UnaryOperator takes an argument of type T and returns a result of type T.
UnaryOperator[T any] func(T) T UnaryOperator[T any] func(T) T
// BinaryOperator takes two arguments of type T and returns a result of type T // BinaryOperator takes two arguments of type T and returns a result of type T.
BinaryOperator[T any] func(T, T) T BinaryOperator[T any] func(T, T) T
// Comparator takes two arguments of type T and returns a boolean result // Comparator takes two arguments of type T and returns a boolean result.
Comparator[T any] func(T, T) bool Comparator[T any] func(T, T) bool
) )

4
go.mod
View File

@ -3,8 +3,8 @@ module pkg.icikowski.pl/collections
go 1.20 go 1.20
require ( require (
github.com/stretchr/testify v1.8.4 github.com/stretchr/testify v1.9.0
golang.org/x/text v0.11.0 golang.org/x/text v0.17.0
) )
require ( require (

8
go.sum
View File

@ -2,10 +2,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

View File

@ -2,23 +2,23 @@ package collections
import "pkg.icikowski.pl/collections/functions" import "pkg.icikowski.pl/collections/functions"
// Optional represents an optional value of type T // Optional represents an optional value of type T.
type Optional[T any] struct { type Optional[T any] struct {
e T e T
present bool present bool
} }
// IsPresent determines whether the underlying value is present // IsPresent determines whether the underlying value is present.
func (o *Optional[T]) IsPresent() bool { func (o *Optional[T]) IsPresent() bool {
return o.present return o.present
} }
// Get returns the underlying value // Get returns the underlying value.
func (o *Optional[T]) Get() T { func (o *Optional[T]) Get() T {
return o.e return o.e
} }
// OrElse returns the underlying value or given value if underlying value is not present // OrElse returns the underlying value or given value if underlying value is not present.
func (o *Optional[T]) OrElse(e T) T { func (o *Optional[T]) OrElse(e T) T {
if !o.present { if !o.present {
return e return e
@ -26,7 +26,7 @@ func (o *Optional[T]) OrElse(e T) T {
return o.e return o.e
} }
// OrElseGet returns the underlying value or value from given supplier if underlying value is not present // OrElseGet returns the underlying value or value from given supplier if underlying value is not present.
func (o *Optional[T]) OrElseGet(s functions.Supplier[T]) T { func (o *Optional[T]) OrElseGet(s functions.Supplier[T]) T {
if !o.present { if !o.present {
return s() return s()
@ -34,7 +34,7 @@ func (o *Optional[T]) OrElseGet(s functions.Supplier[T]) T {
return o.e return o.e
} }
// Transform transforms the underlying value with given [functions.UnaryOperator] if the vale is present // Transform transforms the underlying value with given [functions.UnaryOperator] if the vale is present.
func (o *Optional[T]) Transform(u functions.UnaryOperator[T]) *Optional[T] { func (o *Optional[T]) Transform(u functions.UnaryOperator[T]) *Optional[T] {
if o.present { if o.present {
o.e = u(o.e) o.e = u(o.e)
@ -42,7 +42,7 @@ func (o *Optional[T]) Transform(u functions.UnaryOperator[T]) *Optional[T] {
return o return o
} }
// MapOptional maps optional of type T to optional of type U using given [functions.Function] // MapOptional maps optional of type T to optional of type U using given [functions.Function].
func MapOptional[T, U any](src *Optional[T], mapper functions.Function[T, U]) *Optional[U] { func MapOptional[T, U any](src *Optional[T], mapper functions.Function[T, U]) *Optional[U] {
return &Optional[U]{mapper(src.e), src.present} return &Optional[U]{mapper(src.e), src.present}
} }

265
package-lock.json generated
View File

@ -1,21 +1,21 @@
{ {
"name": "collections", "name": "collections",
"version": "0.1.1-rc.10", "version": "0.1.2-rc.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "collections", "name": "collections",
"version": "0.1.1-rc.10", "version": "0.1.2-rc.3",
"devDependencies": { "devDependencies": {
"@saithodev/semantic-release-gitea": "^2.1.0", "@saithodev/semantic-release-gitea": "^2.1.0",
"@semantic-release/changelog": "^6.0.3", "@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^12.0.0", "@semantic-release/commit-analyzer": "^13.0.0",
"@semantic-release/git": "^10.0.1", "@semantic-release/git": "^10.0.1",
"@semantic-release/npm": "^12.0.0", "@semantic-release/npm": "^12.0.0",
"@semantic-release/release-notes-generator": "^13.0.0", "@semantic-release/release-notes-generator": "^14.0.0",
"conventional-changelog-conventionalcommits": "^7.0.2", "conventional-changelog-conventionalcommits": "^8.0.0",
"semantic-release": "^23.0.0" "semantic-release": "^24.0.0"
} }
}, },
"node_modules/@babel/code-frame": { "node_modules/@babel/code-frame": {
@ -376,14 +376,16 @@
} }
}, },
"node_modules/@semantic-release/commit-analyzer": { "node_modules/@semantic-release/commit-analyzer": {
"version": "12.0.0", "version": "13.0.0",
"resolved": "https://registry.npmjs.org/@semantic-release/commit-analyzer/-/commit-analyzer-12.0.0.tgz", "resolved": "https://registry.npmjs.org/@semantic-release/commit-analyzer/-/commit-analyzer-13.0.0.tgz",
"integrity": "sha512-qG+md5gdes+xa8zP7lIo1fWE17zRdO8yMCaxh9lyL65TQleoSv8WHHOqRURfghTytUh+NpkSyBprQ5hrkxOKVQ==", "integrity": "sha512-KtXWczvTAB1ZFZ6B4O+w8HkfYm/OgQb1dUGNFZtDgQ0csggrmkq8sTxhd+lwGF8kMb59/RnG9o4Tn7M/I8dQ9Q==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"conventional-changelog-angular": "^7.0.0", "conventional-changelog-angular": "^8.0.0",
"conventional-commits-filter": "^4.0.0", "conventional-changelog-writer": "^8.0.0",
"conventional-commits-parser": "^5.0.0", "conventional-commits-filter": "^5.0.0",
"conventional-commits-parser": "^6.0.0",
"debug": "^4.0.0", "debug": "^4.0.0",
"import-from-esm": "^1.0.3", "import-from-esm": "^1.0.3",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
@ -833,21 +835,22 @@
} }
}, },
"node_modules/@semantic-release/release-notes-generator": { "node_modules/@semantic-release/release-notes-generator": {
"version": "13.0.0", "version": "14.0.1",
"resolved": "https://registry.npmjs.org/@semantic-release/release-notes-generator/-/release-notes-generator-13.0.0.tgz", "resolved": "https://registry.npmjs.org/@semantic-release/release-notes-generator/-/release-notes-generator-14.0.1.tgz",
"integrity": "sha512-LEeZWb340keMYuREMyxrODPXJJ0JOL8D/mCl74B4LdzbxhtXV2LrPN2QBEcGJrlQhoqLO0RhxQb6masHytKw+A==", "integrity": "sha512-K0w+5220TM4HZTthE5dDpIuFrnkN1NfTGPidJFm04ULT1DEZ9WG89VNXN7F0c+6nMEpWgqmPvb7vY7JkB2jyyA==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"conventional-changelog-angular": "^7.0.0", "conventional-changelog-angular": "^8.0.0",
"conventional-changelog-writer": "^7.0.0", "conventional-changelog-writer": "^8.0.0",
"conventional-commits-filter": "^4.0.0", "conventional-commits-filter": "^5.0.0",
"conventional-commits-parser": "^5.0.0", "conventional-commits-parser": "^6.0.0",
"debug": "^4.0.0", "debug": "^4.0.0",
"get-stream": "^7.0.0", "get-stream": "^7.0.0",
"import-from-esm": "^1.0.3", "import-from-esm": "^1.0.3",
"into-stream": "^7.0.0", "into-stream": "^7.0.0",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"read-pkg-up": "^11.0.0" "read-package-up": "^11.0.0"
}, },
"engines": { "engines": {
"node": ">=20.8.1" "node": ">=20.8.1"
@ -959,6 +962,13 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"node_modules/@types/semver": {
"version": "7.5.8",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz",
"integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==",
"dev": true,
"license": "MIT"
},
"node_modules/agent-base": { "node_modules/agent-base": {
"version": "7.1.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz",
@ -1500,74 +1510,75 @@
} }
}, },
"node_modules/conventional-changelog-angular": { "node_modules/conventional-changelog-angular": {
"version": "7.0.0", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz", "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-8.0.0.tgz",
"integrity": "sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==", "integrity": "sha512-CLf+zr6St0wIxos4bmaKHRXWAcsCXrJU6F4VdNDrGRK3B8LDLKoX3zuMV5GhtbGkVR/LohZ6MT6im43vZLSjmA==",
"dev": true, "dev": true,
"license": "ISC",
"dependencies": { "dependencies": {
"compare-func": "^2.0.0" "compare-func": "^2.0.0"
}, },
"engines": { "engines": {
"node": ">=16" "node": ">=18"
} }
}, },
"node_modules/conventional-changelog-conventionalcommits": { "node_modules/conventional-changelog-conventionalcommits": {
"version": "7.0.2", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-7.0.2.tgz", "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-8.0.0.tgz",
"integrity": "sha512-NKXYmMR/Hr1DevQegFB4MwfM5Vv0m4UIxKZTTYuD98lpTknaZlSRrDOG4X7wIXpGkfsYxZTghUN+Qq+T0YQI7w==", "integrity": "sha512-eOvlTO6OcySPyyyk8pKz2dP4jjElYunj9hn9/s0OB+gapTO8zwS9UQWrZ1pmF2hFs3vw1xhonOLGcGjy/zgsuA==",
"dev": true, "dev": true,
"license": "ISC",
"dependencies": { "dependencies": {
"compare-func": "^2.0.0" "compare-func": "^2.0.0"
}, },
"engines": { "engines": {
"node": ">=16" "node": ">=18"
} }
}, },
"node_modules/conventional-changelog-writer": { "node_modules/conventional-changelog-writer": {
"version": "7.0.1", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-7.0.1.tgz", "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-8.0.0.tgz",
"integrity": "sha512-Uo+R9neH3r/foIvQ0MKcsXkX642hdm9odUp7TqgFS7BsalTcjzRlIfWZrZR1gbxOozKucaKt5KAbjW8J8xRSmA==", "integrity": "sha512-TQcoYGRatlAnT2qEWDON/XSfnVG38JzA7E0wcGScu7RElQBkg9WWgZd1peCWFcWDh1xfb2CfsrcvOn1bbSzztA==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"conventional-commits-filter": "^4.0.0", "@types/semver": "^7.5.5",
"conventional-commits-filter": "^5.0.0",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
"json-stringify-safe": "^5.0.1", "meow": "^13.0.0",
"meow": "^12.0.1", "semver": "^7.5.2"
"semver": "^7.5.2",
"split2": "^4.0.0"
}, },
"bin": { "bin": {
"conventional-changelog-writer": "cli.mjs" "conventional-changelog-writer": "dist/cli/index.js"
}, },
"engines": { "engines": {
"node": ">=16" "node": ">=18"
} }
}, },
"node_modules/conventional-commits-filter": { "node_modules/conventional-commits-filter": {
"version": "4.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-4.0.0.tgz", "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-5.0.0.tgz",
"integrity": "sha512-rnpnibcSOdFcdclpFwWa+pPlZJhXE7l+XK04zxhbWrhgpR96h33QLz8hITTXbcYICxVr3HZFtbtUAQ+4LdBo9A==", "integrity": "sha512-tQMagCOC59EVgNZcC5zl7XqO30Wki9i9J3acbUvkaosCT6JX3EeFwJD7Qqp4MCikRnzS18WXV3BLIQ66ytu6+Q==",
"dev": true, "dev": true,
"license": "MIT",
"engines": { "engines": {
"node": ">=16" "node": ">=18"
} }
}, },
"node_modules/conventional-commits-parser": { "node_modules/conventional-commits-parser": {
"version": "5.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-6.0.0.tgz",
"integrity": "sha512-ZPMl0ZJbw74iS9LuX9YIAiW8pfM5p3yh2o/NbXHbkFuZzY5jvdi5jFycEOkmBW5H5I7nA+D6f3UcsCLP2vvSEA==", "integrity": "sha512-TbsINLp48XeMXR8EvGjTnKGsZqBemisPoyWESlpRyR8lif0lcwzqz+NMtYSj1ooF/WYjSuu7wX0CtdeeMEQAmA==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"is-text-path": "^2.0.0", "meow": "^13.0.0"
"JSONStream": "^1.3.5",
"meow": "^12.0.1",
"split2": "^4.0.0"
}, },
"bin": { "bin": {
"conventional-commits-parser": "cli.mjs" "conventional-commits-parser": "dist/cli/index.js"
}, },
"engines": { "engines": {
"node": ">=16" "node": ">=18"
} }
}, },
"node_modules/convert-hrtime": { "node_modules/convert-hrtime": {
@ -3188,18 +3199,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/is-text-path": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz",
"integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==",
"dev": true,
"dependencies": {
"text-extensions": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/is-typed-array": { "node_modules/is-typed-array": {
"version": "1.1.13", "version": "1.1.13",
"resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz",
@ -3312,12 +3311,6 @@
"integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
"dev": true "dev": true
}, },
"node_modules/json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
"dev": true
},
"node_modules/jsonfile": { "node_modules/jsonfile": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
@ -3327,31 +3320,6 @@
"graceful-fs": "^4.1.6" "graceful-fs": "^4.1.6"
} }
}, },
"node_modules/jsonparse": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz",
"integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==",
"dev": true,
"engines": [
"node >= 0.2.0"
]
},
"node_modules/JSONStream": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz",
"integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==",
"dev": true,
"dependencies": {
"jsonparse": "^1.2.0",
"through": ">=2.2.7 <3"
},
"bin": {
"JSONStream": "bin.js"
},
"engines": {
"node": "*"
}
},
"node_modules/keyv": { "node_modules/keyv": {
"version": "4.5.4", "version": "4.5.4",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
@ -3513,12 +3481,13 @@
} }
}, },
"node_modules/meow": { "node_modules/meow": {
"version": "12.1.1", "version": "13.2.0",
"resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz",
"integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", "integrity": "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==",
"dev": true, "dev": true,
"license": "MIT",
"engines": { "engines": {
"node": ">=16.10" "node": ">=18"
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
@ -6825,36 +6794,6 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/read-pkg-up": {
"version": "11.0.0",
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-11.0.0.tgz",
"integrity": "sha512-LOVbvF1Q0SZdjClSefZ0Nz5z8u+tIE7mV5NibzmE9VYmDe9CaBbAVtz1veOSZbofrdsilxuDAYnFenukZVp8/Q==",
"deprecated": "Renamed to read-package-up",
"dev": true,
"dependencies": {
"find-up-simple": "^1.0.0",
"read-pkg": "^9.0.0",
"type-fest": "^4.6.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/read-pkg-up/node_modules/type-fest": {
"version": "4.18.2",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.18.2.tgz",
"integrity": "sha512-+suCYpfJLAe4OXS6+PPXjW3urOS4IoP9waSiLuXfLgqZODKw/aWwASvzqE886wA0kQgGy0mIWyhd87VpqIy6Xg==",
"dev": true,
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/read-pkg/node_modules/type-fest": { "node_modules/read-pkg/node_modules/type-fest": {
"version": "4.18.2", "version": "4.18.2",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.18.2.tgz", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.18.2.tgz",
@ -7023,16 +6962,17 @@
} }
}, },
"node_modules/semantic-release": { "node_modules/semantic-release": {
"version": "23.1.1", "version": "24.1.0",
"resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-23.1.1.tgz", "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-24.1.0.tgz",
"integrity": "sha512-qqJDBhbtHsjUEMsojWKGuL5lQFCJuPtiXKEIlFKyTzDDGTAE/oyvznaP8GeOr5PvcqBJ6LQz4JCENWPLeehSpA==", "integrity": "sha512-FwaE2hKDHQn9G6GA7xmqsc9WnsjaFD/ppLM5PUg56Do9oKSCf+vH6cPeb3hEBV/m06n8Sh9vbVqPjHu/1onzQw==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"@semantic-release/commit-analyzer": "^12.0.0", "@semantic-release/commit-analyzer": "^13.0.0-beta.1",
"@semantic-release/error": "^4.0.0", "@semantic-release/error": "^4.0.0",
"@semantic-release/github": "^10.0.0", "@semantic-release/github": "^10.0.0",
"@semantic-release/npm": "^12.0.0", "@semantic-release/npm": "^12.0.0",
"@semantic-release/release-notes-generator": "^13.0.0", "@semantic-release/release-notes-generator": "^14.0.0-beta.1",
"aggregate-error": "^5.0.0", "aggregate-error": "^5.0.0",
"cosmiconfig": "^9.0.0", "cosmiconfig": "^9.0.0",
"debug": "^4.0.0", "debug": "^4.0.0",
@ -7070,6 +7010,7 @@
"resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-4.0.0.tgz", "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-4.0.0.tgz",
"integrity": "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ==", "integrity": "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ==",
"dev": true, "dev": true,
"license": "MIT",
"engines": { "engines": {
"node": ">=18" "node": ">=18"
} }
@ -7079,6 +7020,7 @@
"resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-4.0.0.tgz", "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-4.0.0.tgz",
"integrity": "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==", "integrity": "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==",
"dev": true, "dev": true,
"license": "MIT",
"engines": { "engines": {
"node": ">=18" "node": ">=18"
}, },
@ -7091,6 +7033,7 @@
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-5.0.0.tgz", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-5.0.0.tgz",
"integrity": "sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw==", "integrity": "sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"clean-stack": "^5.2.0", "clean-stack": "^5.2.0",
"indent-string": "^5.0.0" "indent-string": "^5.0.0"
@ -7107,6 +7050,7 @@
"resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-5.2.0.tgz", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-5.2.0.tgz",
"integrity": "sha512-TyUIUJgdFnCISzG5zu3291TAsE77ddchd0bepon1VVQrKLGKFED4iXFEDQ24mIPdPBbyE16PK3F8MYE1CmcBEQ==", "integrity": "sha512-TyUIUJgdFnCISzG5zu3291TAsE77ddchd0bepon1VVQrKLGKFED4iXFEDQ24mIPdPBbyE16PK3F8MYE1CmcBEQ==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"escape-string-regexp": "5.0.0" "escape-string-regexp": "5.0.0"
}, },
@ -7122,6 +7066,7 @@
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",
"integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==",
"dev": true, "dev": true,
"license": "MIT",
"engines": { "engines": {
"node": ">=12" "node": ">=12"
}, },
@ -7130,16 +7075,17 @@
} }
}, },
"node_modules/semantic-release/node_modules/execa": { "node_modules/semantic-release/node_modules/execa": {
"version": "9.1.0", "version": "9.3.1",
"resolved": "https://registry.npmjs.org/execa/-/execa-9.1.0.tgz", "resolved": "https://registry.npmjs.org/execa/-/execa-9.3.1.tgz",
"integrity": "sha512-lSgHc4Elo2m6bUDhc3Hl/VxvUDJdQWI40RZ4KMY9bKRc+hgMOT7II/JjbNDhI8VnMtrCb7U/fhpJIkLORZozWw==", "integrity": "sha512-gdhefCCNy/8tpH/2+ajP9IQc14vXchNdd0weyzSJEFURhRMGncQ+zKFxwjAufIewPEJm9BPOaJnvg2UtlH2gPQ==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"@sindresorhus/merge-streams": "^4.0.0", "@sindresorhus/merge-streams": "^4.0.0",
"cross-spawn": "^7.0.3", "cross-spawn": "^7.0.3",
"figures": "^6.1.0", "figures": "^6.1.0",
"get-stream": "^9.0.0", "get-stream": "^9.0.0",
"human-signals": "^7.0.0", "human-signals": "^8.0.0",
"is-plain-obj": "^4.1.0", "is-plain-obj": "^4.1.0",
"is-stream": "^4.0.1", "is-stream": "^4.0.1",
"npm-run-path": "^5.2.0", "npm-run-path": "^5.2.0",
@ -7149,7 +7095,7 @@
"yoctocolors": "^2.0.0" "yoctocolors": "^2.0.0"
}, },
"engines": { "engines": {
"node": ">=18" "node": "^18.19.0 || >=20.5.0"
}, },
"funding": { "funding": {
"url": "https://github.com/sindresorhus/execa?sponsor=1" "url": "https://github.com/sindresorhus/execa?sponsor=1"
@ -7160,6 +7106,7 @@
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-9.0.1.tgz", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-9.0.1.tgz",
"integrity": "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==", "integrity": "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"@sec-ant/readable-stream": "^0.4.1", "@sec-ant/readable-stream": "^0.4.1",
"is-stream": "^4.0.1" "is-stream": "^4.0.1"
@ -7176,6 +7123,7 @@
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
"dev": true, "dev": true,
"license": "MIT",
"engines": { "engines": {
"node": ">=10" "node": ">=10"
}, },
@ -7184,10 +7132,11 @@
} }
}, },
"node_modules/semantic-release/node_modules/human-signals": { "node_modules/semantic-release/node_modules/human-signals": {
"version": "7.0.0", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-7.0.0.tgz", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-8.0.0.tgz",
"integrity": "sha512-74kytxOUSvNbjrT9KisAbaTZ/eJwD/LrbM/kh5j0IhPuJzwuA19dWvniFGwBzN9rVjg+O/e+F310PjObDXS+9Q==", "integrity": "sha512-/1/GPCpDUCCYwlERiYjxoczfP0zfvZMU/OWgQPMya9AbAE24vseigFdhAMObpc8Q4lc/kjutPfUddDYyAmejnA==",
"dev": true, "dev": true,
"license": "Apache-2.0",
"engines": { "engines": {
"node": ">=18.18.0" "node": ">=18.18.0"
} }
@ -7197,6 +7146,7 @@
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz",
"integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==",
"dev": true, "dev": true,
"license": "MIT",
"engines": { "engines": {
"node": ">=12" "node": ">=12"
}, },
@ -7209,6 +7159,7 @@
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-4.0.1.tgz", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-4.0.1.tgz",
"integrity": "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==", "integrity": "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==",
"dev": true, "dev": true,
"license": "MIT",
"engines": { "engines": {
"node": ">=18" "node": ">=18"
}, },
@ -7221,6 +7172,7 @@
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz",
"integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"path-key": "^4.0.0" "path-key": "^4.0.0"
}, },
@ -7236,6 +7188,7 @@
"resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-3.0.0.tgz", "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-3.0.0.tgz",
"integrity": "sha512-xsrIUgI0Kn6iyDYm9StOpOeK29XM1aboGji26+QEortiFST1hGZaUQOLhtEbqHErPpGW/aSz6allwK2qcptp0Q==", "integrity": "sha512-xsrIUgI0Kn6iyDYm9StOpOeK29XM1aboGji26+QEortiFST1hGZaUQOLhtEbqHErPpGW/aSz6allwK2qcptp0Q==",
"dev": true, "dev": true,
"license": "MIT",
"engines": { "engines": {
"node": ">=12" "node": ">=12"
}, },
@ -7248,6 +7201,7 @@
"resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
"integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
"dev": true, "dev": true,
"license": "MIT",
"engines": { "engines": {
"node": ">=12" "node": ">=12"
}, },
@ -7260,6 +7214,7 @@
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"dev": true, "dev": true,
"license": "ISC",
"engines": { "engines": {
"node": ">=14" "node": ">=14"
}, },
@ -7272,6 +7227,7 @@
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-4.0.0.tgz", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-4.0.0.tgz",
"integrity": "sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw==", "integrity": "sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw==",
"dev": true, "dev": true,
"license": "MIT",
"engines": { "engines": {
"node": ">=18" "node": ">=18"
}, },
@ -7489,15 +7445,6 @@
"integrity": "sha512-sh8PWc/ftMqAAdFiBu6Fy6JUOYjqDJBJvIhpfDMyHrr0Rbp5liZqd4TjtQ/RgfLjKFZb+LMx5hpml5qOWy0qvg==", "integrity": "sha512-sh8PWc/ftMqAAdFiBu6Fy6JUOYjqDJBJvIhpfDMyHrr0Rbp5liZqd4TjtQ/RgfLjKFZb+LMx5hpml5qOWy0qvg==",
"dev": true "dev": true
}, },
"node_modules/split2": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
"integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
"dev": true,
"engines": {
"node": ">= 10.x"
}
},
"node_modules/stream-combiner2": { "node_modules/stream-combiner2": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz",
@ -7732,18 +7679,6 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/text-extensions": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz",
"integrity": "sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==",
"dev": true,
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/thenify": { "node_modules/thenify": {
"version": "3.3.1", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
@ -7765,12 +7700,6 @@
"node": ">=0.8" "node": ">=0.8"
} }
}, },
"node_modules/through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==",
"dev": true
},
"node_modules/through2": { "node_modules/through2": {
"version": "2.0.5", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",

View File

@ -1,4 +1,4 @@
/* /*
Collections-related types and functions Collections and stream-like operations for Go.
*/ */
package collections package collections

View File

@ -1,18 +1,18 @@
{ {
"private": true, "private": true,
"name": "collections", "name": "collections",
"version": "0.1.1-rc.10", "version": "0.1.2-rc.3",
"scripts": { "scripts": {
"release": "./node_modules/.bin/semantic-release" "release": "./node_modules/.bin/semantic-release"
}, },
"devDependencies": { "devDependencies": {
"@saithodev/semantic-release-gitea": "^2.1.0", "@saithodev/semantic-release-gitea": "^2.1.0",
"@semantic-release/changelog": "^6.0.3", "@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^12.0.0", "@semantic-release/commit-analyzer": "^13.0.0",
"@semantic-release/git": "^10.0.1", "@semantic-release/git": "^10.0.1",
"@semantic-release/npm": "^12.0.0", "@semantic-release/npm": "^12.0.0",
"@semantic-release/release-notes-generator": "^13.0.0", "@semantic-release/release-notes-generator": "^14.0.0",
"conventional-changelog-conventionalcommits": "^7.0.2", "conventional-changelog-conventionalcommits": "^8.0.0",
"semantic-release": "^23.0.0" "semantic-release": "^24.0.0"
} }
} }