
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/menefotto/pqueue
Queue can be either a max or min priority queue depending on the given Comparator function.
In order to use it as max priority queue instantiate a pqueue with the New method like so:
func less(i, j int, values []interface{}) bool {
l, _ := values[i].(int)
r, _ := values[j].(int)
return l < r
}
pq := pqueue.New(less)
Otherwise if one wants to create min priority queue instantiate qa pqueue with the New method and a great Comparator function like so:
func greater(i ,j int, values []interface{}) bool {
l, _ := values[i].(int)
r, _ := values[j].(int)
return l > r
}
pq := pqueue.New(great)
Type casting inside the Comparator function is essential since comparison cannot be performed on interfaces. To extract the largest or smallest value ( depending on the queue ), call the Top method or to extract and remove it call PopTop, like so:
v := pq.PopTop() // removes the values
v := pq.Top() // gives a copy of the value not removing it from the queue
This software is developed following the "mantra" keep it simple, stupid or better known as KISS.
Implementation follows closely the implementation given in "Algorithms by Robert Sedgewick".
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.