Test if a value is an array-like object containing only positive integers.
We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we’ve built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.
The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.
When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.
To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url]
Test if a value is an array-like object containing only positive integers.
bash
npm install @stdlib/assert-is-positive-integer-array
script
tag without installation and bundlers, use the [ES Module][es-module] available on the [esm
][esm-url] branch (see [README][esm-readme]).deno
][deno-url] branch (see [README][deno-readme] for usage intructions).umd
][umd-url] branch (see [README][umd-readme]).javascript
var isPositiveIntegerArray = require( '@stdlib/assert-is-positive-integer-array' );
value
is an array-like object containing only positive integer
values.javascript
var Number = require( '@stdlib/number-ctor' );
var bool = isPositiveIntegerArray( [ 3.0, new Number(3.0) ] );
// returns true
bool = isPositiveIntegerArray( [ 3.0, '3.0' ] );
// returns false
value
is an array-like object containing only positive primitive integer
values.javascript
var Number = require( '@stdlib/number-ctor' );
var bool = isPositiveIntegerArray.primitives( [ 1.0, 2.0, 10.0 ] );
// returns true
bool = isPositiveIntegerArray.primitives( [ 3.0, new Number(1.0) ] );
// returns false
value
is an array-like object containing only positive object integer
values.javascript
var Number = require( '@stdlib/number-ctor' );
var bool = isPositiveIntegerArray.objects( [ new Number(3.0), new Number(1.0) ] );
// returns true
bool = isPositiveIntegerArray.objects( [ 1.0, 2.0, 10.0 ] );
// returns false
javascript
var Number = require( '@stdlib/number-ctor' );
var isPositiveIntegerArray = require( '@stdlib/assert-is-positive-integer-array' );
var bool = isPositiveIntegerArray( [ 5, 2, 3 ] );
// returns true
bool = isPositiveIntegerArray( [ 1, new Number( 6 ), 3 ] );
// returns true
bool = isPositiveIntegerArray( [ 0, 1, 2, 3, 4 ] );
// returns false
bool = isPositiveIntegerArray( [ 1, 'abc', 3 ] );
// returns false
bool = isPositiveIntegerArray( [ 2.3, 1, 3 ] );
// returns false
bool = isPositiveIntegerArray( [] );
// returns false