1.0.14 • Published 1 year ago

nearest-prime v1.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

npm (scoped) NPM npm Sponsor

Nearest Prime

Overview

  • This package exports one function with the signature:
nearestPrime(input: number | string, allowInvalidInput: boolean = false): number | undefined
  • The function takes a number (including decimal numbers), and returns the nearest prime number, rounding up if necessary. (Ex. passing 6 will return 7, not 5)
  • The function takes an optional argument allowInvalidInput which defaults to false. When passed as true, numbers less than 1 will return 2 instead of undefined

How to use

  • In your project, run
npm install nearest-prime

to install the latest version to your node_modules dependency folder

  • In the file you'd like to use the nearestPrime function, add
import { nearestPrime } from 'nearest-prime'

to the top of the file

In Action

alt text

Fixes & Improvements

Head over to the GitHub Issues tab to report a bug or suggest an improvement. Feel free to contribute to the code or documentation by raising a pull request.

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago