
Security News
New React Server Components Vulnerabilities: DoS and Source Code Exposure
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.
rough-sortedness
Advanced tools
Utility to compute the rough sortedness of a list.
Rough-Sortedness takes the ratio of the number of incrementing sequences in an array and divides it by the length of the total array to estimate the general sortedness of the array.
Warning: this rough sortedness metric is blind to interleaved sorted sequences, and reversed but perfectly sorted arrays will return a score of 0.
const roughSortedness = require('rough-sortedness')
var sorted = [1,2,3,4,5,6]
var unsorted = [1,2,3,4,6,5]
console.log(roughSortedness(sorted) > roughSortedness(unsorted))
roughSortedness(arr, (a,b)=>{return a.value - b.value})
The function expects an array of items, and a comparator function. If no comparator function is provided, it will default to function defaultComparator (a, b) {return a - b}. The function returns a value from 0 to 1, where 1 is perfectly sorted, and 0 is impossibly unsorted.
$ npm install rough-sortedness
FAQs
Utility to compute the rough sortedness of a list
The npm package rough-sortedness receives a total of 0 weekly downloads. As such, rough-sortedness popularity was classified as not popular.
We found that rough-sortedness demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.