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 🙏

© 2025 – Pkg Stats / Ryan Hefner

cheesenan

v0.0.9

Published

CheeseNaN is a utility library for robust number validation in JavaScript and TypeScript, including precise NaN checks, mathematical utilities, and range validations.

Readme

README for CheeseNaN


CheeseNaN

CheeseNaN is a lightweight and versatile utility library for robust number validation in JavaScript and TypeScript. It simplifies working with numbers by providing a suite of functions to handle edge cases, perform checks, and validate mathematical properties.


Features

  • 🧀 Robust NaN checks: Beyond isNaN and Number.isNaN.
  • 🧮 Comprehensive number tests: Positive, negative, zero, even, odd, integers, floats.
  • 📐 Mathematical utilities: Prime numbers, powers of n, perfect squares.
  • 🎛 Custom checks: Validate ranges, divisibility, and more.

Installation

Install via npm or yarn:

npm install cheesenan

Or use a CDN for vanilla projects:

import * as cheesenan from 'https://unpkg.com/statello@latest/dist/cheesenan.min.js'

Usage

Basic Checks

import { cheeseNaN, cheeseValidNumber, cheeseInteger } from 'cheesenan';

console.log(cheeseNaN(NaN)); // true
console.log(cheeseValidNumber(42)); // true
console.log(cheeseInteger(42.5)); // false

Advanced Checks

import { cheesePrime, cheeseWithinRange, cheesePowerOfN } from 'cheesenan';

console.log(cheesePrime(7)); // true
console.log(cheeseWithinRange(10, 5, 15)); // true
console.log(cheesePowerOfN(16, 2)); // true (16 is 2^4)
console.log(cheesePowerOfN(27, 3)); // true (27 is 3^3)

Working with Arrays

import { cheeseAllAreNumbers, cheeseSomeAreNaN } from 'cheesenan';

console.log(cheeseAllAreNumbers([1, 2, 3])); // true
console.log(cheeseSomeAreNaN([1, NaN, 3])); // true

API Reference

Number Validation

  • cheeseNaN(value: any): boolean
    Returns true if the value is NaN or not a number.

  • cheeseValidNumber(value: any): boolean
    Returns true if the value is a finite number.

  • cheeseInteger(value: any): boolean
    Returns true if the value is an integer.

  • cheeseFloat(value: any): boolean
    Returns true if the value is a finite float (non-integer).

  • cheeseNonZeroNumber(value: any): boolean
    Returns true if the value is a non-zero number.


Mathematical Properties

  • cheesePositive(value: any): boolean
    Returns true if the value is a positive number.

  • cheeseNegative(value: any): boolean
    Returns true if the value is a negative number.

  • cheesePrime(value: any): boolean
    Returns true if the value is a prime number.

  • cheesePowerOfN(value: any, n: number): boolean
    Returns true if the value is a power of n.

  • cheesePerfectSquare(value: any): boolean
    Returns true if the value is a perfect square.


Range and Divisibility

  • cheeseWithinRange(value: any, min: number, max: number): boolean
    Returns true if the value is within the range [min, max].

  • cheeseDivisibleBy(value: any, divisor: number): boolean
    Returns true if the value is divisible by the given divisor.


Working with Arrays

  • cheeseAllAreNumbers(values: any[]): boolean
    Returns true if all elements in the array are valid numbers.

  • cheeseSomeAreNaN(values: any[]): boolean
    Returns true if at least one element in the array is NaN.


Roadmap

  1. Performance Optimization: Improve speed for large datasets (e.g., prime number checks).
  2. Extended Mathematical Utilities: Add functions for Fibonacci checks, GCD/LCM, etc.
  3. Type-safe Input Validation: Enhance TypeScript support with stricter typings.
  4. Integration: Provide plugins for frameworks like React or Vue for runtime validation.

Contributing

Contributions are welcome! Feel free to submit issues or pull requests.


License

Licensed under the MIT License.