
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.
A loot drop table implementation in JavaScript.
LootTable is used to make a random choice among a weighted list of alternatives for item drops, map generation, and many other processes. There's a good overview of loot tables on Lost Garden.
var LootTable = require('loot-table');
var loot = new LootTable();
loot.add('sword', 20);
loot.add('shield', 5);
loot.add('gold', 5);
loot.add(null, 1);
var item = loot.choose(); // most likely a sword, sometimes null
Weights are arbitrary, not percentages, and don't need to add up to 100.
If one item has a weight of 2 and another has a weight of 1, the first item
is twice as likely to be chosen. If quantity is given, then calls to choose()
will only return that item while some are available. Each choose() that
selects that item will reduce its quantity by 1.
Items can be anything, not just strings. They can be arrays, numbers, JSON data, null, functions... even another LootTable!
import LootTable from 'loot-table';
var loot = new LootTable();
loot.add('sword', 20);
loot.add('shield', 5);
loot.add('gold', 5);
loot.add(null, 1);
var item = loot.choose(); // most likely a sword, sometimes null
include a <script src="dist/loot-table.global.js"></script> tag on your page and you can use loot table as a global variable.
FAQs
A loot drop table implementation in JavaScript
We found that loot-table 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.