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

camote-utils

v1.1.86

Published

A comprehensive TypeScript utility library featuring advanced string and number formatting, data structures, and algorithms

Readme

Camote Utils

A comprehensive TypeScript utility library featuring advanced string and number formatting functions.

npm version License: MIT Total Downloads Coverage Maintenance GitHub Stars Twitter Follow

Highlights

  • A comprehensive TypeScript utility library featuring advanced string and number formatting, data structures, and algorithms.

Installation

npm install camote-utils

Basic Usage

Import the functions you need:

import { 
   _,
  humanReadableNumber, 
  formatCurrency,
  formatDecimals,
  calculateDiscountPrice,
  pluralize,
  generateUUID,
  isUrl,
  isUuid,
  isDateWithinRange,
} from 'camote-utils';

// Format numbers
// Basic formatting
_.humanReadableNumber(1234567.89)               // "1.2M"

// With units
_.humanReadableNumber(1500, { decimals: 0 })      // "2K"

// Format decimals with different rounding modes
formatDecimals(1.2345, 2);         // "1.23"
formatDecimals(1.2345, 2, 'ceil'); // "1.24"

_.mask('1234567890') // '1234******'
_.mask('123456NiCe', '#') // '1234######'

// Format currency
formatCurrency(1234.56);                 // "$1,234.56"
formatCurrency(1234.56, 'EUR');          // "€1,234.56"
formatCurrency(1234.56, 'JPY', 'ja-JP'); // "¥1,235"

// Calculate discounted prices
calculateDiscountPrice(100, 20);      // 80.00 (20% off)
calculateDiscountPrice(100, 30, '$'); // 70.00 ($30 off)

// Pluralize words
pluralize('cat', 1) // 'cat'
pluralize('cat', 2) // 'cats'
pluralize('box', 2) // 'boxes'
pluralize('baby', 2) // 'babies'
pluralize('person', 1, 'people') // 'person'
pluralize('person', 2, 'people') // 'people'    

// Basic UUID generation (v4)
generateUUID()     // e.g., "123e4567-e89b-12d3-a456-426614174000"

// Specific UUID versions
generateUUIDv4()   // e.g., "110ec58a-a0f2-4ac4-8393-c866d813b8d1"

// Validate strings
isUrl('https://example.com');  // true
isUuid('123e4567-e89b-12d3-a456-426614174000');  // 

// Check if date is within range
const date = new Date('2024-01-15')
const start = new Date('2024-01-01')
const end = new Date('2024-01-31')

isDateWithinRange(start, end, date);  // true
// Check if the current date is within the range
isDateWithinRange(start, end)  // true (using default date value now())

// Chain Syntax
// String operations
const capitalized = _.chain('hello world')
  .capitalize()
  .toCamelCase()
  .valueOf(); // "HelloWorld"

// Number formatting
const formattedCurrency = _.chain(1234.56)
  .formatCurrency('USD')
  .valueOf(); // "$1,234.56"

// Array operations
const doubledFiltered = _.chain([1, 2, 3, 4])
  .map(x => x * 2) // Double each number
  .filter(x => x > 4) // Keep only numbers greater than 4
  .valueOf(); // [6, 8]

For full documentation, please visit our documentation site.

Security Policy

For information about our security policy and how to report vulnerabilities, please see our Security Policy.

License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT © Rhynel

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.