npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

numery

v1.0.3

Published

A collection of useful helper functions for numbers manipulation in Javascript

Downloads

2

Readme

Numery

Numery is a collection of useful helper functions for numbers manipulation in Javascript

Installation

yarn add numery

Usage

const { isValidNumber } = require('numery')

Contents

For Numbers in General

isValidNumber

  • 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.

isEvenNumber

  • Signature: isEvenNumber(x: Any) => boolean
  • Verify if the argument is an even number.
  • Return true if even. false otherwise.

isOddNumber

  • Signature: isOddNumber(x: Any) => boolean
  • Verify if the argument is an odd number.
  • Return true if odd. false otherwise.

isFiniteNumber

  • 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.

isFinitePositiveNumber

  • 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.

isFiniteNegativeNumber

  • 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.

isNumberMultipleOf

  • 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.

For Integers

isInteger

  • 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.

isPositiveInteger

  • 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.

isStrictPositiveInteger

  • 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.

isNegativeInteger

  • Signature: isNegativeInteger(x: Any) => boolean
  • Verify if a given number is a valid negative integer.
  • Return true if a negative integer. false otherwise.