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

general-formatter

v0.0.16

Published

JS package for general string formatting. Dates, currencies, etc.

Readme

general-formatter

general-formatter

Description

This is a small npm package, with a few functions that I use very often. I got tired of having to code it many different projects :)

The functions a very straightforward. I'm using the Intl object from JavaScript that provides language sensitive string comparison, number formatting, and date-time formatting. Check the official MDN docs here JS Intl

Disclaimer

This is my first ever npm package, so if you have any suggestions or a better solution you are more than welcome to contribute to this project. Or if you want to keep adding more formatting or format validation functions :). But please let's keep it simple.

Installation

Fork this repository, and follow the git commands bellow:

cd <YourProjectName>
npm i general-formatter

How to use?

general-formatter uses ES6 so you need to use imports :)

import {convertToMoneyString, convertToDateString, validateEmailFormat} from "general-formatter"

Sample Functions

convertToMoneyString

This function takes a number amount, string country code, the style you want the number to be returned to, and the currency code

const myMoneyString = convertToMoneyString(29.465654023, "en-US", "currency", "USD")

console.log(myMoneyString) // Logs $29.47

convertToDateString

This function takes a date-like string, and a country code string referring to the country date format you want your date to be returned.

const myDateString = convertToDateString("2022-10-10T22:11:02.024+00:00", "en-US")

console.log(myDateString) // Logs 10/10/2022

validateEmailFormat

This function takes an string, and uses regex to validate if the string has a valid email format.

const isValidEmail = validateEmailFormat("johndoe")

console.log(isValidEmail) // Logs false

How to contribute

  • Fork this repository
  • Follow the git commands in your favorite terminal
    git clone [email protected]:<gitHubUsername>/formatter-npm-package.git
    cd formatter-npm-package
    git checkout -b <NameYourNewBranch>
  • After adding your changes please commit the new branch and open a PR
    git add <YourChanges>
    git commit -m <Your changes comments>
    git push origin <Your branch name>
  • Pull Request in GitHub Pull Request