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

@7uan/utils

v1.1.1

Published

This is the repository to make some utils functions, re-libraries, helpers, constants, types, etc...

Readme

📦 @7uan/utils

A collection of utility functions to simplify common JavaScript/TypeScript operations.

📑 Table of Contents

⚙️ Installation

npm install @7uan/utils

or using Yarn:

yarn add @7uan/utils

or using pnpm:

pnpm add @7uan/utils

🚀 Usage

import {
  convertObjectKeysToCamelCase,
  convertObjectKeysToSnakeCase,
  convertToSlug,
  formatCurrency,
  formatQueryString,
  getFileInfo,
  getReasonPhrase,
  getStatusCode,
  removeEmptyQueryParams,
  sleep,
} from '@7uan/utils'

🔧 Functions

convertObjectKeysToCamelCase

Convert object keys from snake_case to camelCase.

Parameters:

  • data The object or array of objects to process. It can be any object or array of objects.

Returns: ConvertObjectKeysToCamelCaseReturnType The transformed result, which is a string.

Example:

const result = convertObjectKeysToCamelCase([{ snake_case_key: 'value' }])

console.log(result) // "Processed output"

convertObjectKeysToSnakeCase

Convert object keys to snake case.

Parameters:

  • data The object or array of objects to process. It can be any object or array of objects.

Returns: ConvertObjectKeysToSnakeCaseReturnType The transformed result, which is a string.

Example:

const result = convertObjectKeysToSnakeCase([{ snake_case_key: 'value' }])

console.log(result) // "Processed output"

convertToSlug

Convert a string to a slug.

Parameters:

  • text The text to be transformed.

Returns: The slug.

Example:

const text = 'Hello World'
const slug = convertToSlug(text)
console.log(slug) // hello-world

formatCurrency

Formats a number into a currency string.

Parameters:

  • amount The number to format.
  • locale The locale to use. Default is en-US.
  • currency The currency to use. Default is USD.

Returns: Returns the formatted currency string.

Example:

const amount = 1000
const locale = 'en-US'
const currency = 'USD'
const result = formatCurrency(amount, locale, currency)
console.log(result)
// => $1,000.00

formatQueryString

Formats a URL with path parameters and query parameters.

  • pathParams (string | number | (string | number)[]): The path parameters to be appended to the baseUrl.
  • query (Record<string, any>): The query parameters to be appended to the URL as a query string.

Parameters:

    • baseUrl (string): The base URL to which the pathParams and query parameters will be appended.

Returns: FormatQueryStringReturnType The transformed result, which is a string.

Example:

const result = formatQueryString([{ snake_case_key: 'value' }])

console.log(result) // "Processed output"

getFileInfo

Type for file information result

Example:

const file = new File(['content'], 'example.jpg')
const fileName = getFileInfo.name(file.name)
const extension = getFileInfo.extension(file.name)
const size = getFileInfo.size(file.size)
const { width, height } = await getFileInfo.dimensions(file)
const info = await getFileInfo.all(file)

console.log(info) // { name: 'example', extension: 'jpg', size: '8 Bytes', width: 0, height: 0 }

getReasonPhrase

Returns the reason phrase for the given status code. If the given status code does not exist, an error is thrown.

Parameters:

  • statusCode The HTTP status code

Returns: The associated reason phrase (e.g. "Bad Request", "OK")

Example:

const reasonPhrase = getReasonPhrase(404)
console.log(reasonPhrase) // "Not Found"

getStatusCode

Returns the status code for the given reason phrase. If the given reason phrase does not exist, undefined is returned.

Parameters:

  • reasonPhrase The HTTP reason phrase (e.g. "Bad Request", "OK")

Returns: The associated status code

Example:

const statusCode = getStatusCode('Not Found')
console.log(statusCode) // 404

removeEmptyQueryParams

Removes empty query parameters from an object or array of objects.

Parameters:

  • data The object or array of objects to process. It can be any object or array of objects.

Returns: RemoveEmptyQueryParamsReturnType The transformed result, which is a string.

Example:

const result = removeEmptyQueryParams([{ snake_case_key: 'value' }])

console.log(result) // "Processed output"

sleep

Sleep for the specified number of seconds.

Parameters:

  • data The object or array of objects to process. It can be any object or array of objects.

Returns: Returns a promise that resolves after the specified number of seconds.

Example:

const result = sleep([{ snake_case_key: 'value' }])

console.log(result) // "Processed output"

🤝 Contributing

Contributions are welcome! Please open an issue or submit a pull request.

📄 License

MIT