
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
countingup
Advanced tools
Countingup is a 10x math library. It provides a Counter class to count up and down with customizations. There are also math utilities that you can use with it.
Using npm:
npm install countingup
In Node.js
const countingup = require('countingup')
The Counter class provides a tool to count numbers.
Initializing
const Counter = countingup.Counter
const myCounter = new Counter()
Counting
myCounter.count()
console.log(myCounter.getCurrentNumber()) // 1
Resetting
myCounter.reset()
console.log(myCounter.getCurrentNumber()) // 0
Customizing the Increment
myCounter.count()
console.log(myCounter.getCurrentNumber()) // 1
myCounter.count(3)
console.log(myCounter.getCurrentNumber()) // 4
Customizing the Direction
This allows you to change the direction so it counts down and subtracts
myCounter.reset()
myCounter.count(5)
console.log(myCounter.getCurrentNumber()) // 5
myCounter.count(5, countingup.Counter.DIRECTION.REVERSE) // 0
By default it will be forwards (countingup.Counter.DIRECTION.FORWARDS)
Customizing the Starting Number
const myCounter2 = new Counter(4)
console.log(myCounter2.getCurrentNumber()) // 4
myCounter2.reset(3)
console.log(myCounter2.getCurrentNumber()) // 3
Countingup includes a suite of math functions that power the underlying logic and can be used for standalone calculations. These utilities handle both numbers and numeric strings.
const { add, subtract, multiply, divide } = require("countingup")
console.log(add(5, 10)) // 15
console.log(subtract(20, 5)) // 15
console.log(multiply(3, 4)) // 12
console.log(divide(100, 4)) // 25
const { modulo, pow } = require("countingup")
console.log(modulo(10, 3)) // 1
console.log(pow(2, 3)) // 8
Countingup provides some USEFUL constants.
const assert = require("assert")
const countingup = require("countingup")
assert(countingup.E === Math.E)
assert(countingup.PI === Math.PI)
assert(countingup.SQRT2 === Math.SQRT2)
assert(countingup.SQRT1_2 === Math.SQRT1_2)
assert(countingup.LN2 === Math.LN2)
assert(countingup.LN10 === Math.LN10)
assert(countingup.LOG2E === Math.LOG2E)
assert(countingup.LOG10E === Math.LOG10E)
assert(countingup.ZERO === 0)
assert(countingup.NaN !== countingup.NaN)
assert(countingup.POSITIVE_INFINITY === Infinity)
assert(countingup.NEGATIVE_INFINITY === -Infinity)
Countingup has tests. They are not very comprehensive, because they were generated by AI, but they are tests.
FAQs
Counter Class for JavaScript
We found that countingup demonstrated a healthy version release cadence and project activity because the last version was released less than 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.