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

@bakemono-san/utilities

v1.0.0

Published

this is a lightweight and modular library providing a comprehensive set of utility functions to streamline development workflows. It is designed to simplify common tasks in software projects, including string manipulation, array operations, date handling,

Readme

@bakemono-san/utilities

A collection of reusable utility functions for JavaScript projects. These functions simplify common programming tasks like string manipulation, array operations, date handling, number calculations, and object processing. Designed for efficiency and reusability.

Table of Contents

Installation

Install the package using npm:

npm install @bakemono-san/utilities

Or link it locally for development:

npm link

Features

  • String Utilities: Functions for transforming and validating strings.
  • Array Utilities: Helpers for array manipulation.
  • Date Utilities: Tools for working with dates and times.
  • Number Utilities: Functions for number calculations and validation.
  • Object Utilities: Helpers for deep merging, cloning, and more.

Usage

Importing Functions

If you are using ES Modules (ESM):

import { capitalize } from '@bakemono-san/utilities';

console.log(capitalize('hello world')); // Output: Hello world

If you are using CommonJS:

const { capitalize } = require('@bakemono-san/utilities');

console.log(capitalize('hello world')); // Output: Hello world

API Documentation

String Utilities

capitalize(str)

Capitalizes the first letter of a string.

capitalize('hello'); // Returns: 'Hello'

Parameters:

  • str (string): The string to capitalize.

Returns:

  • (string): The capitalized string.

Throws:

  • TypeError: If the input is not a string.

toSnakeCase(str)

Converts the given string to snake_case.

toSnakeCase('Hello World'); // Returns: 'hello_world'

Parameters:

  • str (string): The string to convert.

Returns:

  • (string): The snake_cased string.

Throws:

  • TypeError: If the input is not a string.

reverseString(str)

Reverses the given string.

reverseString('hello'); // Returns: 'olleh'

Parameters:

  • str (string): The string to reverse.

Returns:

  • (string): The reversed string.

Throws:

  • TypeError: If the input is not a string.

isPalindrome(str)

Checks if a string is a palindrome.

isPalindrome('racecar'); // Returns: true

Parameters:

  • str (string): The string to check.

Returns:

  • (boolean): True if the string is a palindrome, false otherwise.

Throws:

  • TypeError: If the input is not a string.

Array Utilities

removeDuplicates(arr)

Removes duplicate values from an array.

removeDuplicates([1, 2, 2, 3, 3, 3]); // Returns: [1, 2, 3]
removeDuplicates(['a', 'a', 'b']); // Returns: ['a', 'b']

Parameters:

  • arr (Array): The array from which to remove duplicates.

Returns:

  • (Array): A new array with duplicates removed.

Throws:

  • TypeError: If the input is not an array.

flattenArray(arr)

Flattens a nested array.

flattenArray([1, [2, [3, [4]]]]); // Returns: [1, 2, 3, 4]
flattenArray(['a', ['b', ['c']]]); // Returns: ['a', 'b', 'c']

Parameters:

  • arr (Array): The array to flatten.

Returns:

  • (Array): A new flattened array.

Throws:

  • TypeError: If the input is not an array.

findMax(arr)

Finds the maximum value in an array.

findMax([1, 2, 3, 4]); // Returns: 4
findMax([10, 5, 8, 3]); // Returns: 10

Parameters:

  • arr (Array): The array to search for the maximum value.

Returns:

  • (number): The maximum value in the array.

Throws:

  • TypeError: If the input is not an array.

chunkArray(arr, size)

Splits an array into chunks of a specified size.

chunkArray([1, 2, 3, 4, 5], 2); // Returns: [[1, 2], [3, 4], [5]]
chunkArray(['a', 'b', 'c', 'd'], 3); // Returns: [['a', 'b', 'c'], ['d']]

Parameters:

  • arr (Array): The array to split into chunks.
  • size (number): The size of each chunk.

Returns:

  • (Array): A new array with the original array split into chunks.

Throws:

  • TypeError: If the first parameter is not an array or the second parameter is not a number.

findMin(arr)

Finds the minimum value in an array.

findMin([1, 2, 3, 4]); // Returns: 1
findMin([10, 5, 8, 3]); // Returns: 3

Parameters:

  • arr (Array): The array to search for the minimum value.

Returns:

  • (number): The minimum value in the array.

Throws:

  • TypeError: If the input is not an array.

sumArray(arr)

Sums all the values in an array.

sumArray([1, 2, 3, 4]); // Returns: 10
sumArray([5, 5, 5]); // Returns: 15

Parameters:

  • arr (Array): The array to sum.

Returns:

  • (number): The sum of all values in the array.

Throws:

  • TypeError: If the input is not an array.

averageArray(arr)

Calculates the average of all values in an array.

averageArray([1, 2, 3, 4]); // Returns: 2.5
averageArray([5, 5, 5, 5]); // Returns: 5

Parameters:

  • arr (Array): The array to calculate the average.

Returns:

  • (number): The average of all values in the array.

Throws:

  • TypeError: If the input is not an array.

uniqueArray(arr)

Filters out duplicate values from an array.

uniqueArray([1, 2, 2, 3, 3, 3]); // Returns: [1, 2, 3]
uniqueArray(['a', 'a', 'b']); // Returns: ['a', 'b']

Parameters:

  • arr (Array): The array to filter for unique values.

Returns:

  • (Array): A new array with only unique values.

Throws:

  • TypeError: If the input is not an array.

arrayDifference(arr1, arr2)

Computes the difference between two arrays.

arrayDifference([1, 2, 3], [2, 4]); // Returns: [1, 3]
arrayDifference(['a', 'b'], ['b', 'c']); // Returns: ['a']

Parameters:

  • arr1 (Array): The first array.
  • arr2 (Array): The second array.

Returns:

  • (Array): A new array with elements from the first array that are not in the second array.

Throws:

  • TypeError: If either input is not an array.

Date Utilities

formatDate(date)

Formats a given date object into a string in the format 'YYYY-MM-DD'.

formatDate(new Date()); // Returns: '2025-01-11'

getDaysDifference(date1, date2)

Calculates the absolute difference in days between two dates.

getDaysDifference('2025-01-01', '2025-01-11'); // Returns: 10

isWeekend(date)

Checks if a given date falls on a weekend (Saturday or Sunday).

isWeekend('2025-01-11'); // Returns: true

getDay(date)

Gets the day of the month from a given date.

getDay('2025-01-11'); // Returns: 11

getMonth(date)

Gets the month from a given date.

getMonth('2025-01-11'); // Returns: 1

getYear(date)

Gets the year from a given date.

getYear('2025-01-11'); // Returns: 2025

Development

Cloning the Repository

Clone the repository locally:

git clone https://github.com/bakemono-san/utilities.git

Running Tests

Install the dependencies:

npm install

Run the tests:

npm test

Testing Locally

Use npm link to test your package locally:

npm link
cd path/to/your/test/project
npm link @bakemono-san/utilities

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes or suggestions.

License

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