
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.
better-js-integer
Advanced tools
A better way to ensafe javascript integers from being treated as octal numbers
A better way to ensafe javascript integers from being treated as octal numbers
when you pass an integer with leading zeros such as 0112 to any javascript operator, it looks inside the digits, if all digits are less than 8, it behaves like your integer is in base 8 (Octal) and converts it internally to base 10. But if you integer has any digit greater than or equal to 8, Javascript will treat the integer as an integer in base 10.
This is why if you evalute 0112 + 1 in any javascript console, you'll get the output of 75. Becase 0112 has digits all less than 8, javascript treats it as an octal number and converts it to base 10, so the result would 74.
0112(8) ==> 74(10)
npm install better-js-integer --save
import { ensafe } from 'js-better-integer'
ensafe(0122) // returns 122
Be sure to write and run tests before sending any PR!
To run tests: npm test
Credit: Farzad YZ farskid@gmail.com MIT Licensed.
FAQs
A better way to ensafe javascript integers from being treated as octal numbers
We found that better-js-integer 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.