Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
is-natural-number
Advanced tools
Readme
Check if a value is a natural number
npm install is-natural-number
bower install is-natural-number
var isNaturalNumber = require('shinnn/is-natural-number.js');
Download the script file directly.
number: Number
option: Object
Return: Boolean
It returns true
if the first argument is one of the natural numbers. If not, or the argument is not a number, it returns false
.
isNaturalNumber(10); //=> true
isNaturalNumber(-10); //=> false
isNaturalNumber(10.5); //=> false
isNaturalNumber(Infinity); //=> false
isNaturalNumber('10'); //=> false
Check the test for more detailed specifications.
Type: Boolean
Default: false
By default the number 0
is not regarded as a natural number.
Setting this option true
makes 0
regarded as a natural number.
isNaturalNumber(0); //=> false
isNaturalNumber(0, {includeZero: true}); //=> true
Copyright (c) 2014 - 2016 Shinnosuke Watanabe
Licensed under the MIT License.
FAQs
Check if a value is a natural number
The npm package is-natural-number receives a total of 2,337,764 weekly downloads. As such, is-natural-number popularity was classified as popular.
We found that is-natural-number 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
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.