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

@ykob/js-util

v2.0.0

Published

Private JavaScript utility functions created by @ykob

Readme

js-util

Private JavaScript utility functions created by @ykob.

Modules

| Module | Summary | | ------------- | ------------------------------------------------------------------- | | debounce | Thinning out a function running continuously. | | MathEx | My own expansions of the standard Math functions. | | sleep | Returning a blank Promise that has a timer for await. | | splitNum | Returning a number array that is split an original number by digit. | | zeroPadding | Returning a number string that is applied zero padding. |

Install

WIP

Usage

debounce(callback: (event: unknown) => void, duration: number): ((event?: unknown) => void)

Thin out a function running continuously.

import { debounce } from '@ykob/js-util'

const resize = () => {
  // ...
}
window.addEventListener('resize', debounce(resize, 100))

MathEx

My own expansions of the standard Math functions.

import { MathEx } from '@ykob/js-util'

MathEx.clamp(value: number, min: number, max: number): number

Constrain value to be between min and max.

MathEx.degrees(radians: number): number

Convert a quantity in radians to degrees.

MathEx.mix(x0: number, x1: number, a: number): number

Return a point of 'a' with Linear interpolation between x0 and x1.

MathEx.radians(degrees: number): number

Convert a quantity in degrees to radians.

MathEx.randomArbitrary(min: number, max: number): number

Return a random floating number between min and max.

MathEx.randomInt(min: number, max: number): number

Return a random integer between min and max.

MathEx.smoothstep(e0: number, e1: number, x: number): number

MathEx.spherical(radian1: number, radian2: number, radius: number): number

Return the Spherical coordinate as a number array.

MathEx.step(edge: number, x: number): number

Return 0 if x is less than edge, and return 1 otherwise.

sleep(delay: number): Promise<void>

Return Promise<void> that awaits for the time delay.

import { sleep } from '@ykob/js-util'

const asyncFunc = async () => {
  await sleep(100)
}

splitNum(num: number): number[]

Return a number array that is split num by digit.

import { splitNum } from '@ykob/js-util'

const arr = splitNum(123) // toEqual [1, 2, 3]

zeroPadding(num: number, digit: number): string

Return a number string that is applied "Zero Padding" to num.
Defined the digits of "Zero Padding" by digit.

import { zeroPadding } from '@ykob/js-util'

const num1 = zeroPadding(1, 2) // toBe '01'
const num2 = zeroPadding(123, 6) // toBe '000123'