primparity

1.0.5 • Public • Published

PrimParity 0 - dependencies 100% - clean code npm javascript

Returns true or false depending on the number's parity (odd/even) and primality (prime/composite). Also checks if integer does not exceed the JavaScript MAXIMUM_SAFE_INTEGER.

Install

Install with npm:

npm i primparity

Usage

const prp = require('primparity');

//Check Parity (odd/even)

//odd
prp.checkParity.odd(1); //true
prp.checkParity.odd(2); //false
//even
prp.checkParity.even(1); //false
prp.checkParity.even(2); //true

//Check Primality (prime/composite)

//prime
prp.checkPrimality.prime(2); //true
prp.checkPrimality.prime(4); //false
//composite
prp.checkPrimality.composite(2); //false
prp.checkPrimality.composite(4); //true

About

Author wQ (iamstrawberry)
Contributing Pull requests and stars are always welcome.

License

Copyright © 2023, wQ. Released under the MIT License.

Package Sidebar

Install

npm i primparity

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

5.46 kB

Total Files

4

Last publish

Collaborators

  • iamstrawberry