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

helplib

v4.0.1

Published

Boost your project development with this helpful toolkit

Readme

helplib

helplib is a modern, lightweight npm toolkit that provides useful utility functions for dates, formatting, and data generation.

Installation

You can install the module using the npm:

npm install helplib

Table of Contents


Functions

The module includes functions that are grouped into different categories. You can import them using ES Modules or CommonJS:

// ES Modules / TypeScript
import { formatDate, generateId } from 'helplib';

// CommonJS
const { formatDate, generateId } = require('helplib');

Date functions

formatDate(date, format)

Formats the given date object as a string using the specified format.

  • date: The date object to format. If not provided, the current date and time will be used.
  • format: The format string to use. Defaults to M/d/y H:m:s. (M: Month, d: day, H: Hours, m: minutes, s: seconds, f: miliseconds, y: year)
console.log(formatDate()); // 02/19/2023 17:04:1
console.log(formatDate(new Date(), 'd/MM/y H:mm:s')); // 19/02/2023 17:04:1
console.log(formatDate(undefined, 'd/MM/y H:mm:s:f')); // 19/02/2023 17:04:1:95

getDayOfWeek(date, locale)

Gets the name of the day of the week for the given date object.

  • date: The date object to get the day of the week for. If not provided, the current date.
  • locale: The locale to use for the day of the week name. Defaults to "en-US".
console.log(getDayOfWeek()); // Sunday
console.log(getDayOfWeek(new Date(), 'en-US')); // Sunday
console.log(getDayOfWeek(undefined, 'tr-TR')); // Pazar

getMonthName(date, locale)

Gets the name of the month for the given date object.

  • date: The date object to get the month name for. If not provided, the current date.
  • locale: The locale to use for the month name. Defaults to "en-US".
console.log(getMonthName()); // February
console.log(getMonthName(new Date(), 'en-US')); // February
console.log(getMonthName(undefined, 'tr-TR')); // Şubat

getYearAndWeekNumber(date)

Gets the year and week number for the given date object.

  • date: The date object to get the year and week number for. If not provided, the current date.
console.log(getYearAndWeekNumber()); // { year: 2023, weekNumber: 7 }

Formatting functions

formatData(data, text)

Replaces placeholders in a string with corresponding values from an object.

  • data: The object containing the data to replace the placeholders with.
  • text: The string containing placeholders.
const data = { name: 'John Doe', age: 32, city: 'New York' };
const text = 'Hi, my name is {name} and I am {age} years old. I live in {city}.';

console.log(formatData(data, text)); 
// Hi, my name is John Doe and I am 32 years old. I live in New York.

formatString(text, ...params)

Replaces numbered placeholders in a string with values.

  • text: The string containing placeholders (e.g., {0}, {1}).
  • ...params: The values to replace the placeholders with.
const result = formatString("My name is {0}, I am {1} years old and I live in {2}.", "John Doe", 30, "USA");
console.log(result); // My name is John Doe, I am 30 years old and I live in USA.

Generation functions

generateId(length)

Generates a unique ID.

  • length: The length of the generated ID. Default is 11. (Note: Minimum length is 6, maximum length is 15).
console.log(generateId()); // 47545019992 => length = 11;
console.log(generateId(5)); // 014915 => length = 6;
console.log(generateId(16)); // 226306621525260 => length = 15;

generatePassword(length)

Generates a random password.

  • length: The length of the generated password. Default is 8. (Note: Minimum length is 8).
console.log(generatePassword()); // i2o2a3My => length = 8;
console.log(generatePassword(7)); // fUYzWVZ0 => length = 8;

License

helplib is released under the MIT License.