🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

is-whole-number-array

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-whole-number-array

check whether an array contains only whole numbers. the elements in the array can have real javascript numbers or javasript numbers in string

1.0.2
latest
Source
npm
Version published
Maintainers
2
Created
Source

is-whole-number-array

isWholeNumberArray is a module that takes an array and it checks if the elements in the array are whole numbers. The elements can be string whole number or just whole numbers. Built in ES6, transpiled to ES5 using babel.

Installation

npm install is-whole-number-array --save

Usage


var isWholeNumberArray = require('is-whole-number-array');

var wholeNumberArray = [1, 2, 3];
var stringWholeNumbersArray = ['1', '2', '3'];
var realNumberArray = [1.1, 2.2, 3.3];
var stringRealNumberArray = ['1.1', '2.2', '3.3'];

console.log(isWholeNumberArray(wholeNumberArray)); // true
console.log(isWholeNumberArray(stringWholeNumbersArray)); // true
console.log(isWholeNumberArray(realNumberArray)); // false
console.log(isWholeNumberArray(stringRealNumberArray)); // false

Run Code Sample

npm start

Tests

npm test

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Release History

  • 2015-09-30 1.0.2 Initial release

License

MIT license; see LICENSE.

(c) 2015 by Abdul Khan and Alexey Novak

Keywords

array of numbers

FAQs

Package last updated on 30 Sep 2015

Did you know?

Socket

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.

Install

Related posts