Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Blazing fast array sorting that outperforms lodash sorting by ~2x (in some cases it's more then 5x). Take a look at the benchmark section for more information about performance.
import sort from 'fast-sort';
sort([1,4,2]).asc(); // sort array in ascending order [1, 2, 4]
sort([1,4,2]).desc(); // sort array in descending order [4, 2, 1]
// Sort persons [Object] ascending by lowercase firstName
sort(persons).asc((p) => p.firstName.toLowerCase());
// Sort persons by multiple properties
sort(persons).desc([
(p) => p.firstName, // Sort by first name
(p) => p.lastName, // Persons that have same firstName will be sorted by lastName
(p) => p.dob // Persons that have same firstName and lastName will be sorted by dob
]);
// Sorting values that are not sortable will return same value back
sort(null).asc(); // => null
sort(33).desc(); // => 33
// npm install fast-sort --save
import sort from 'fast-sort'; // Loads unmodified es6 code
import sort from 'fast-sort/sort.es5'; // Loads transpiled es5 code
import sort from 'fast-sort/sort.es5.min'; // Loads transpiled minified es5 code
// We can import same module through js-flock library
// npm install js-flock --save
import sort from 'js-flock/sort'; // === import sort from 'fast-sort';
import sort from 'js-flock/es5/sort'; // === import sort from 'fast-sort/sort.es5';
import sort from 'js-flock/es5/sort.min'; // === import sort from 'fast-sort/sort.es5.min';
Benchmarking sort is not an easy task as there is so many different scenarios that can happen while sorting. Because of that 5 different benchmarks have been created to test how fast-sort is behaving on different inputs and sort scenarios. Each benchmark is run with different array sizes from small 100 items to large 100 000 items.
Every run of benchmark outputs different results but the results are constantly better then lodash sort and in following benchmark score ranges from 1.37x to 13.51x faster then lodash sort. This will vary on each benchmark run but it should not vary too much.
Benchmark has been run on:
To run benchmark on your PC follow steps from below
In case you notice any irregularities in benchmark or you want to add sort library to benchmark score please open issue here
FAQs
Fast easy to use and flexible sorting with TypeScript support
The npm package fast-sort receives a total of 82,649 weekly downloads. As such, fast-sort popularity was classified as popular.
We found that fast-sort demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.