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

moxules

v1.1.0

Published

Modules for m-ox

Readme

moxules

Tiny modules from m.ox. Moxules, if you will.

This package is a small handful of utility functions for the moments when your code needs a little polish, a little color, or a little less accidental whitespace.

Install

npm install moxules

Usage

import {
  chunk,
  clamp,
  hex,
  pascalToHuman,
  stripDoubleSpaces
} from 'moxules'

hex()
// "#3fa91c"

pascalToHuman('TinyUsefulModule')
// "Tiny Useful Module"

stripDoubleSpaces('easy  there,   spacebar')
// "easy there, spacebar"

chunk([1, 2, 3, 4], 2)
// [[1, 2], [3, 4]]

clamp(12, 0, 10)
// 10

API

Arrays

  • chunk(items, size) splits an array into smaller arrays.
  • compact(items) removes null and undefined.
  • unique(items) removes duplicate values.
  • sample(items) returns one random item, or undefined for an empty array.

Design

  • hex() returns a random six-digit hex color string.
  • isHexColor(value) checks whether a string is a valid 3- or 6-digit hex color.
  • hexToRgb(value) converts a hex color to { red, green, blue }, or null if invalid.
  • rgbToHex(red, green, blue) converts RGB channels to a hex color string.

Numbers

  • clamp(value, min, max) keeps a number inside a range.
  • randomInt(min, max) returns a random integer between two bounds, inclusive.
  • roundTo(value, places) rounds a number to a fixed number of decimal places.
  • sum(values) adds an array of numbers.

Strings

  • pascalToHuman(value) turns PascalCase into a human-readable title.
  • stripDoubleSpaces(value) collapses runs of regular spaces into one space.
  • capitalize(value) uppercases the first character.
  • slugify(value) converts text into a lowercase URL-style slug.
  • normalizeWhitespace(value) collapses all whitespace runs and trims the result.
  • truncate(value, maxLength) shortens text and adds ... when there is room.

hex()

Returns a random six-digit hex color string.

hex() // "#a0f4c9"

pascalToHuman(value)

Turns PascalCase into a human-readable title with spaces.

pascalToHuman('PascalCaseTitle') // "Pascal Case Title"

stripDoubleSpaces(value)

Collapses accidental runs of regular spaces into a single space.

stripDoubleSpaces('too  much   room') // "too much room"

License

ISC