just-is-prime

Check if number is prime

Usage no npm install needed!

<script type="module">
  import justIsPrime from 'https://cdn.skypack.dev/just-is-prime';
</script>

README

just-is-prime

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-is-prime
yarn add just-is-prime

Check if number is prime

  import isPrime from 'just-is-prime;

/*
  isPrime(1); // false
  isPrime(2); // true
  isPrime(17); // true
  isPrime(10); // false
  isPrime(); // throws
  isPrime(null); // throws
  isPrime("js"); // throws
  isPrime({}); // throws
  isPrime(function() {}); // throws
  isPrime([]); // throws
*/