
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
sortable-map
Advanced tools
Dictionary data structure with flexible sort capabilities
npm i -S sortable-map
import SortableMap from 'sortable-map';const SortableMap = require('sortable-map');const map = new SortableMap();
const key = 'foo' // Key must be a string literal
const value = 'bar; // Value can be anything
map.add(key, value);
map.has('foo'); // true
map.find('foo'); // 'bar'
map.findAll(); // [{ key: 'foo', value: 'bar' }]
map.isEmpty(); // false
map.count(); // 1
may.keys(); // [ 'foo' ]
may.values(); // [ 'bar' ]
map.has('baz'); // false
map.find('baz'); // undefined
map.delete('foo'); // 'bar'
map.count() // 0
map.add('foo', 'bar');
map.add('ham', 'egg');
map.clear();
map.count(); // 0
By default findAll() returns the map sorted by key ascending. If your values are objects, pass a property name (findAll('sortOrder)) for finer sorting:
map.add('abc', { sortOrder: 20 });
map.add('xyz', { sortOrder: 0 });
map.add('nop', { sortOrder: 10 });
map.findAll(); // [{key: 'abc', value: { sortOrder: 20 }, ...];
map.findAll('sortOrder'); // [{key: 'xyz', value: { sortOrder: 0 }, ...];
const map = new SortableMap();
map.add('foo', 'bar');
forEach(cb)map.forEach(entry => {
entry.key; // 'foo'
entry.value; // 'bar'
));
forEachKey(cb)map.forEachKey(key => {
key; // 'foo'
));
forEachValue(cb)map.forEachValue(value => {
value; // 'bar'
));
FAQs
Dictionary data structure with flexible sort capabilities
We found that sortable-map 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.