
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
matrix-counter
Advanced tools
A simple iterator for counting along a matrix that contains varied numerical bases
A simple iterator for counting along a matrix that contains varied numerical bases.
MatrixCounter is a simple library for iterating and counting about a matrix that contains varied numerical bases for each index. Example use cases include constructing clocks (24 hour, 12 hour, binary), creating permutations from an array of strings, or reducing measurements of smaller units to larger units.
npm install matrix-counter
import MatrixCounter from '../dist/index';
const d = new Date();
const clock = new MatrixCounter(
[24, 60, 60], //numeric base
[d.getHours(), d.getMinutes(), d.getSeconds()] //initial state
);
const format = n => n < 10 ? '0' + n : n;
// Worth noting that using setInterval to increment a clock is a pretty horrid idea
setInterval(() => {
if (clock.hasNext()) {
clock.next();
} else {
clock.reset();
}
const [ hours, minutes, seconds ] = clock.peek();
console.log(`${format(hours)}:${format(minutes)}:${format(seconds)}`);
}, 1000);
$ make dependencies # install node modules, works with yarn
$ make lint # lint code
$ make test # test code
$ make # build code
FAQs
A simple iterator for counting along a matrix that contains varied numerical bases
We found that matrix-counter 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
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.