
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
is-zero-or-positive-integer
Advanced tools
Node.js helper function: test variables for being a zero or a positive integer.
Node.js helper function: test variables for being a zero or a positive integer.
npm install is-zero-or-positive-integer
const isZeroOrPositiveInteger = require('is-zero-or-positive-integer');
/*
If you only want to check for safe integers:
const isZeroOrPositiveInteger = require('is-zero-or-positive-integer').onlyTrueIfSafe;
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER for further reference.
*/
// numbers
console.log( isZeroOrPositiveInteger(0) ); //true
console.log( isZeroOrPositiveInteger(1) ); //true
console.log( isZeroOrPositiveInteger(-1) ); //false
console.log( isZeroOrPositiveInteger(2147483647) ); //true
console.log( isZeroOrPositiveInteger(-2147483648) ); //false
console.log( isZeroOrPositiveInteger(Number.MAX_SAFE_INTEGER) ); //true
console.log( isZeroOrPositiveInteger(Number.MIN_SAFE_INTEGER) ); //false
console.log( isZeroOrPositiveInteger(1e+23) ); //true
console.log( isZeroOrPositiveInteger(-1e+23) ); //false
// strings
console.log( isZeroOrPositiveInteger('0') ); //true
console.log( isZeroOrPositiveInteger('1') ); //true
console.log( isZeroOrPositiveInteger('01') ); //true
console.log( isZeroOrPositiveInteger('-1') ); //false
console.log( isZeroOrPositiveInteger('2147483647') ); //true
console.log( isZeroOrPositiveInteger('-2147483648') ); //false
console.log( isZeroOrPositiveInteger('9007199254740991') ); //true
console.log( isZeroOrPositiveInteger('-9007199254740991') ); //false
console.log( isZeroOrPositiveInteger('1e+23') ); //true
console.log( isZeroOrPositiveInteger('-1e+23') ); //false
console.log( isZeroOrPositiveInteger('string') ); //false
// other
console.log( isZeroOrPositiveInteger({}) ); //false
console.log( isZeroOrPositiveInteger([]) ); //false
console.log( isZeroOrPositiveInteger(Symbol()) ); //false
console.log( isZeroOrPositiveInteger(new Date()) ); //false
console.log( isZeroOrPositiveInteger(new Date().getTime()) ); //true
console.log( isZeroOrPositiveInteger(function() { return; }) ); //false
/* visual representation mode (vrm):
if set true then consider values with
- scientific notation (1e+23)
- leading zeroes ('0123')
as being no integer!
*/
console.log( isZeroOrPositiveInteger(1e+23, true) ); //false
console.log( isZeroOrPositiveInteger('01', true) ); //false
FAQs
Node.js helper function: Test variables for being zero or a positive integer.
The npm package is-zero-or-positive-integer receives a total of 0 weekly downloads. As such, is-zero-or-positive-integer popularity was classified as not popular.
We found that is-zero-or-positive-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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.