Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/writetome51/error-if-not-integer-zero-or-greater

Function triggers error if argument is not integer of zero or greater
https://github.com/writetome51/error-if-not-integer-zero-or-greater

error integer javascript message not type-check

Last synced: about 16 hours ago
JSON representation

Function triggers error if argument is not integer of zero or greater

Awesome Lists containing this project

README

        

# errorIfNotIntegerZeroOrGreater(arg): void

In order to not trigger an error, `arg` must be type 'number' and an
integer of 0 or greater.

## Examples
```
errorIfNotIntegerZeroOrGreater('1');
// Error: "Input must be a finite number of type 'number' "

errorIfNotIntegerZeroOrGreater(0.55);
// Error: "Input must be integer"

errorIfNotIntegerZeroOrGreater(-2);
// Error: "Input must be an integer not less than 0"

errorIfNotIntegerZeroOrGreater(2); // no error.
```

## Installation
`npm i error-if-not-integer-zero-or-greater`

## Loading
```js
import { errorIfNotIntegerZeroOrGreater} from 'error-if-not-integer-zero-or-greater';
```