
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
github.com/yaa110/goterator
Iterator implementation for Golang to provide map and reduce functionalities.
import (
"github.com/yaa110/goterator"
"github.com/yaa110/goterator/generator"
)
words := []interface{}{"an", "example", "of", "goterator"}
gen := generator.NewSlice(words)
chn := make(chan interface{}, 4)
chn <- "an"
chn <- "example"
chn <- "of"
chn <- "goterator"
close(chn)
gen := generator.NewChannel(chn)
type TestGenerator struct {
words []string
i int
value string
}
func (g *TestGenerator) Next() bool {
if g.i == len(g.words) {
return false
}
g.value = g.words[g.i]
g.i++
return true
}
func (g *TestGenerator) Value() interface{} {
return g.value
}
gen := &TestGenerator{
words: []string{"an", "example", "of", "goterator"},
i: 0,
value: "",
}
lengths := goterator.New(gen).Map(func(word interface{}) interface{} {
return len(word.(string))
}).Collect()
assert.Equal([]interface{}{2, 7, 2, 9}, lengths)
Please for more information about mappers and reducers (consumers) check the documentation.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.