
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
sorted-collection
Advanced tools
An high-performance array-like JavaScript collection that maintains the sort order of its elements. To be used in place of a regular array of objects.
A high-performance array-like JavaScript collection that maintains the sort order of its elements. To be used in place of a regular array of objects.
In addition to basic Array functions like push
, splice
, unshift
, and forEach
, SortedCollection introduces new sort-oriented functions, like:
insert
.
When a value is insert'ed
into the collection, it is automatically spliced to the correct position based on the collection's sortDefinition
.
The default sortDefinition
sorts by id:
[{ property: 'id', direction: 'asc' }]
npm install sorted-collection --save
var SortedCollection = require('sorted-collection'),
sortedCollection = new SortedCollection();
sortedCollection.insert({ id: 3 });
sortedCollection.insert({ id: 1 });
sortedCollection.insert({ id: 2 });
console.log('1st item is id #1:', sortedCollection[0]);
console.log('2nd item is id #2:', sortedCollection[1]);
console.log('3rd item is id #3:', sortedCollection[2]);
var SortedCollection = require('sorted-collection'),
sortedCollection = new SortedCollection();
// set sort by "name", then by "id" descending
sortedCollection.sortDefinition = [{ property: 'name', direction: 'asc' }, { property: 'id', direction: 'desc' }];
// insert objects
sortedCollection.insert({ id: 1, name: 'Z' });
sortedCollection.insert({ id: 2, name: 'B' });
sortedCollection.insert({ id: 3, name: 'K' });
sortedCollection.insert({ id: 4, name: 'Z' });
// the order of items is properly sorted
console.log('1st item is id #2:', sortedCollection[0]);
console.log('2nd item is id #3:', sortedCollection[1]);
console.log('3rd item is id #4:', sortedCollection[2]);
console.log('4rd item is id #1:', sortedCollection[3]);
npm test
Send a GitHub pull request for any changes you recommend. Please add or update unit tests for any new or changed functionality.
FAQs
An high-performance array-like JavaScript collection that maintains the sort order of its elements. To be used in place of a regular array of objects.
We found that sorted-collection 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.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.