
Product
Socket Now Protects the Chrome Extension Ecosystem
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Remembers the highest/lowest values in a data set of any size. Useful if you have a large number of values, but are only interested in the n
highest (or lowest) ones. If you looking for a stream version, check out hifo-stream.
m
of n
values, the time complexity is O(m * n)
.50
, it will only store 50 values in memory.sort
function.Let's assume we have a huge array of people.
var people = [
{ name: 'Alice', age: 23 },
{ name: 'Eve', age: 45 },
{ name: 'Jane', age: 19 },
{ name: 'Bob', age: 30 },
{ name: 'John', age: 60 },
// thousands of others
];
To find the 3 oldest people, we reate a new Hifo
instance and pass the 'age'
as the filter key and 3
as the size.
var hifo = require('hifo');
var oldest = hifo(hifo.highest('age'), 3);
for (var person in people) {
oldest.add(person);
}
oldest.data
will now look like this:
[
{ name: 'John', age: 60 },
{ name: 'Eve', age: 45 },
{ name: 'Bob', age: 30 }
]
Of course you can do this kind of filtering with hifo.lowest
as well.
If you have a question, found a bug or want to propose a feature, have a look at the issues page.
FAQs
Remembers the highest/lowest values in a data set of any size.
The npm package hifo receives a total of 58,045 weekly downloads. As such, hifo popularity was classified as popular.
We found that hifo 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.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.