https://github.com/maevadevs/numery
NodeJS: A collection of useful helper functions for numbers manipulation in JS that I wrote. This is available on NPM.
https://github.com/maevadevs/numery
javascript-library npm-package numbers-manipulation numery
Last synced: 6 months ago
JSON representation
NodeJS: A collection of useful helper functions for numbers manipulation in JS that I wrote. This is available on NPM.
- Host: GitHub
- URL: https://github.com/maevadevs/numery
- Owner: maevadevs
- License: mit
- Created: 2018-12-30T19:44:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-31T18:36:58.000Z (over 7 years ago)
- Last Synced: 2025-10-14T04:22:32.898Z (9 months ago)
- Topics: javascript-library, npm-package, numbers-manipulation, numery
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Numery
Numery is a collection of useful helper functions for numbers manipulation in Javascript
## Installation
```
yarn add numery
```
## Usage
```js
const { isValidNumber } = require('numery')
```
## Contents
- [For Numbers in General](#numbers-in-general)
- [`isValidNumber`](#isValidNumber)
- [`isEvenNumber`](#isEvenNumber)
- [`isOddNumber`](#isOddNumber)
- [`isFiniteNumber`](#isFiniteNumber)
- [`isFinitePositiveNumber`](#isFinitePositiveNumber)
- [`isStrictFinitePositiveNumber`](#isStrictFinitePositiveNumber)
- [`isFiniteNegativeNumber`](#isFiniteNegativeNumber)
- [`isNumberMultipleOf`](#isNumberMultipleOf)
- [For Integers](#for-integers)
- [`isInterger`](#isInteger)
- [`isPositiveInteger`](#isPositiveInteger)
- [`isStrictPositiveInteger`](#isStrictPositiveInteger)
- [`isNegativeInteger`](#isNegativeInteger)
- Signature: `isValidNumber(x: Any) => boolean`
- Verify that the given argument data type is in fact a valid number.
- A valid number is any number between `[-Infinity, Infinity]`, including the infinities, but not `NaN`.
- To exclude infinities, use `isFiniteNumber(x)` instead
- Return `true` if a valid number. `false` otherwise.
- Signature: `isEvenNumber(x: Any) => boolean`
- Verify if the argument is an even number.
- Return `true` if even. `false` otherwise.
- Signature: `isOddNumber(x: Any) => boolean`
- Verify if the argument is an odd number.
- Return `true` if odd. `false` otherwise.
- Signature: `isFiniteNumber(x: Any) => boolean`
- Verify that the argument is in fact a finite number.
- A finite number is a valid number that is not an infinity (+ or -).
- Return `true` if a finite number. `false` otherwise.
- Signature: `isFinitePositiveNumber(x: Any) => boolean`
- Verify that the argument is in fact a finite and positive number, including `0`
- A finite number is a valid number that is not an infinity (+ or -).
- Return `true` if a finite positive number. `false` otherwise.
### `isStrictFinitePositiveNumber`
- Signature: `isStrictFinitePositiveNumber(x: Any) => boolean`
- Verify that the argument is in fact a finite and strictly positive number, not including `0`
- A finite number is a valid number that is not an infinity (+ or -).
- Return `true` if a strict finite positive number. `false` otherwise.
- Signature: `isFiniteNegativeNumber(x: Any) => boolean`
- Verify that the argument is in fact a finite and negative number
- A finite number is a valid number that is not an infinity (+ or -).
- Return `true` if a finite negative number. `false` otherwise.
- Signature: `isNumberMultipleOf(x: Any, y: Any) => boolean`
- Verify if the first argument is a multiple of the second argument.
- NOTE: Second argument must be a strict positive number. return false otherwise.
- Return `true` if multiple. `false` otherwise.
- Signature: `isInteger(x: Any) => boolean`
- Verify if a given number is a valid integer.
- Infinities are not integers.
- Return `true` if an integer. `false` otherwise.
- Signature: `isPositiveInteger(x: Any) => boolean`
- Verify if a given number is a valid positive integer, including 0.
- Return `true` if a positive integer. `false` otherwise.
- Signature: `isStrictPositiveInteger(x: Any) => boolean`
- Verify if a given number is a valid positive integer, strictly not equal to `0`.
- Return `true` if a strict positive integer. `false` otherwise.
- Signature: `isNegativeInteger(x: Any) => boolean`
- Verify if a given number is a valid negative integer.
- Return `true` if a negative integer. `false` otherwise.