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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@comscen/islib

v1.0.4

Published

A collection of blazing-fast is* utility functions. Because typeof undefined === 'undefined' is SO much typing.

Readme

@comscen/islib

Because typeof undefined === 'undefined' is SO much typing.

A collection of blazing-fast is* utility functions for JavaScript and TypeScript. Over 80 functions covering numbers, strings, arrays, types, dates, and booleans.

Heavily inspired by the legendary is-even package (which has 900k+ weekly downloads), but with slightly more functions. Just slightly.

npm version license

Installation

npm install @comscen/islib

Usage

import {
  isEven,
  isPrime,
  isPalindrome,
  isURL,
  isLeapYear,
} from "@comscen/islib";

isEven(42); // true  (bitwise AND, obviously)
isPrime(7919); // true  (6k±1 optimized)
isPalindrome("racecar"); // true  (two-pointer, zero allocations)
isURL("https://example.com"); // true
isLeapYear(2000); // true
isHappy(7); // true  (Floyd's cycle detection)
isFibonacci(89); // true  (perfect square math trick, O(1))

API

Numbers

| Function | Description | Algorithm | | ------------------------ | ----------------------- | --------------------------------- | | isEven(n) | n is even | (n & 1) === 0 bitwise AND | | isOdd(n) | n is odd | (n & 1) !== 0 bitwise AND | | isPositive(n) | n > 0 | comparison | | isNegative(n) | n < 0 | comparison | | isZero(n) | n === 0 | strict equality | | isPowerOfTwo(n) | n is a power of 2 | (n & (n-1)) === 0 bit trick | | isInteger(n) | no fractional part | Number.isInteger | | isFloat(n) | finite non-integer | isFinite && !isInteger | | isNaN(n) | not a number | n !== n identity trick | | isInfinity(n) | ±Infinity | equality check | | isPrime(n) | prime number | 6k±1 trial division | | isPerfectSquare(n) | perfect square | Math.sqrt floor check | | isFibonacci(n) | Fibonacci number | 5n²±4 perfect square check (O(1)) | | isDivisibleBy(n, d) | n % d === 0 | modulo | | isMultipleOf(n, m) | alias for isDivisibleBy | modulo | | isWholeNumber(n) | non-negative integer | isInteger && n >= 0 | | isInRange(n, min, max) | min ≤ n ≤ max | comparison | | isBetween(n, min, max) | min < n < max | strict comparison | | isPerfectNumber(n) | sum of divisors = n | trial division | | isTriangular(n) | triangular number | 8n+1 perfect square check | | isNumericPalindrome(n) | palindrome number | two-pointer scan | | isArmstrong(n) | narcissistic number | digit power sum | | isDigitAnagram(n, m) | same digits | sorted digit comparison | | isHappy(n) | happy number | Floyd's cycle detection |

Strings

| Function | Description | | --------------------- | -------------------------------------- | | isPalindrome(s) | reads same forwards and backwards | | isAnagram(s1, s2) | same characters, different order | | isEmail(s) | valid email address | | isURL(s) | valid http/https/ftp URL | | isEmpty(s) | length === 0 | | isBlank(s) | empty or whitespace-only | | isUpperCase(s) | all uppercase letters | | isLowerCase(s) | all lowercase letters | | isAlpha(s) | only a–z, A–Z | | isAlphanumeric(s) | only a–z, A–Z, 0–9 | | isHexColor(s) | valid CSS hex color (#RGB or #RRGGBB) | | isIPv4(s) | valid IPv4 address | | isIPv6(s) | valid IPv6 address | | isJSON(s) | valid JSON string | | isNumericString(s) | coercible to a finite number | | isTitleCase(s) | Title Case formatting | | isBase64(s) | valid base64 encoding | | isUUID(s) | valid UUID v1–v5 | | isWhitespace(s) | non-empty, only whitespace chars | | isASCII(s) | only code points 0–127 | | isSemVer(s) | valid semantic version | | isStrongPassword(s) | ≥8 chars, upper, lower, digit, special | | isHexString(s) | valid hexadecimal byte string |

Arrays

| Function | Description | | ------------------------------- | ---------------------------------------- | | isArrayEmpty(arr) | arr.length === 0 | | isSorted(arr) | ascending order | | isSortedDesc(arr) | descending order | | isSubset(arr, parent) | all elements exist in parent | | isUnique(arr) | no duplicate elements | | isFlat(arr) | no nested arrays | | isEqualArray(a, b) | same elements in same order (===) | | isArrayContaining(arr, value) | value exists in array | | isAll(arr, predicate) | every element satisfies predicate | | isAny(arr, predicate) | at least one element satisfies predicate | | isNone(arr, predicate) | no element satisfies predicate |

Types

| Function | Description | | ---------------------- | -------------------------------------------- | | isArray(v) | Array.isArray | | isObject(v) | plain object (not array, not class instance) | | isFunction(v) | callable value | | isString(v) | string primitive | | isNumber(v) | number primitive (excludes NaN) | | isFiniteNumber(v) | finite number (excludes NaN and ±Infinity) | | isBoolean(v) | true or false | | isNull(v) | === null | | isUndefined(v) | === undefined | | isNullOrUndefined(v) | null or undefined | | isSymbol(v) | Symbol | | isBigInt(v) | BigInt | | isDate(v) | valid Date instance | | isRegExp(v) | RegExp | | isPromise(v) | Promise or thenable | | isIterable(v) | implements Symbol.iterator | | isMap(v) | Map instance | | isSet(v) | Set instance | | isError(v) | Error instance | | isClassInstance(v) | non-plain object with prototype |

Dates

| Function | Description | | --------------------- | -------------------------- | | isLeapYear(year) | Gregorian leap year | | isWeekend(date) | Saturday or Sunday | | isWeekday(date) | Monday through Friday | | isBefore(d1, d2) | d1 < d2 | | isAfter(d1, d2) | d1 > d2 | | isToday(date) | same calendar day as today | | isValidDate(value) | valid Date object | | isPast(date) | before now | | isFuture(date) | after now | | isSameDay(d1, d2) | same year/month/day | | isSameMonth(d1, d2) | same year/month | | isSameYear(d1, d2) | same year |

Booleans

| Function | Description | | ------------------------ | ---------------------------- | | isTrue(v) | === true | | isFalse(v) | === false | | isTruthy(v) | coerces to true | | isFalsy(v) | coerces to false | | isStrictlyTrue(v) | alias for isTrue | | isStrictlyFalse(v) | alias for isFalse | | isEitherBoolean(v) | true or false | | isAllTruthy(...values) | all values are truthy | | isAnyTruthy(...values) | at least one value is truthy |

Performance

Most functions run in O(1) time with zero heap allocations. Key optimizations:

  • Bitwise tricks: isEven / isOdd use bitwise AND instead of modulo
  • Power of two: isPowerOfTwo uses the classic (n & (n - 1)) === 0 single-instruction trick
  • NaN detection: isNaN uses n !== n — the fastest possible NaN check (NaN is the only value not equal to itself)
  • Fibonacci: isFibonacci uses the 5n²±4 perfect square theorem — O(1), no sequence generation
  • Triangular numbers: isTriangular uses the 8n+1 perfect square theorem — O(1)
  • Primality: isPrime uses 6k±1 trial division, checking ~√n/3 candidates
  • Happy numbers: isHappy uses Floyd's two-pointer cycle detection — no growing Sets
  • Anagram: isAnagram uses a Map for O(n) character frequency instead of sorting
  • Subset: isSubset builds a parent Set for O(m+n) instead of O(m·n)
  • Palindrome: isPalindrome / isNumericPalindrome use two-pointer scan — no string reversal allocation
  • ASCII: isASCII uses a raw charCode loop — no regex engine overhead

Tree-shaking

@comscen/islib ships both CommonJS and ESM builds. Any modern bundler will tree-shake unused functions automatically.

// Only isEven ends up in your bundle
import { isEven } from "@comscen/islib";

Zero dependencies

No runtime dependencies. TypeScript types are included.

License

MIT