
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 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')
/**
Numbers & Strings
*/
isZeroOrPositiveInteger(0) // true
isZeroOrPositiveInteger(1) // true
isZeroOrPositiveInteger(2147483647) // true
isZeroOrPositiveInteger(Number.MAX_SAFE_INTEGER) // true
isZeroOrPositiveInteger(1e+23) // true
isZeroOrPositiveInteger('0') // true
isZeroOrPositiveInteger('1') // true
isZeroOrPositiveInteger('01') // true
isZeroOrPositiveInteger('2147483647') // true
isZeroOrPositiveInteger('9007199254740991') // true
isZeroOrPositiveInteger('1e+23') // true
isZeroOrPositiveInteger(-1) // false
isZeroOrPositiveInteger(1.2) // false
isZeroOrPositiveInteger(-1.2) // false
isZeroOrPositiveInteger(-2147483648) // false
isZeroOrPositiveInteger(Number.MIN_SAFE_INTEGER) // false
isZeroOrPositiveInteger(-1e+23) // false
isZeroOrPositiveInteger('-1') // false
isZeroOrPositiveInteger('1.2') // false
isZeroOrPositiveInteger('-1.2') // false
isZeroOrPositiveInteger('-2147483648') // false
isZeroOrPositiveInteger('-9007199254740991') // false
isZeroOrPositiveInteger('-1e+23') // false
isZeroOrPositiveInteger('string') // false
/**
Other
*/
isZeroOrPositiveInteger(null) // false
isZeroOrPositiveInteger(undefined) // false
isZeroOrPositiveInteger('') // false
isZeroOrPositiveInteger(true) // false
isZeroOrPositiveInteger({}) // false
isZeroOrPositiveInteger([]) // false
isZeroOrPositiveInteger(/regex/) // false
isZeroOrPositiveInteger(Symbol()) // false
isZeroOrPositiveInteger(new Date()) // false
isZeroOrPositiveInteger(function() { return }) // false
When set to true
the following is NOT considered a valid positive integer:
const isZeroOrPositiveInteger = require('is-zero-or-positive-integer')
isZeroOrPositiveInteger(1e+23, true) // false
isZeroOrPositiveInteger('01', true) // false
True is only returned for integers being less or equal than Number.MAX_SAFE_INTEGER
.
Visit developer.mozilla.org
for further reference.
const isZeroOrPositiveInteger = require('is-zero-or-positive-integer').onlyTrueIfSafe
isZeroOrPositiveInteger(Number.MAX_SAFE_INTEGER) // true
isZeroOrPositiveInteger(Number.MAX_SAFE_INTEGER + 1) // false
isZeroOrPositiveInteger(1e+23) // false
isZeroOrPositiveInteger(Number.MAX_VALUE) // false
ISC
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.