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 🙏

© 2024 – Pkg Stats / Ryan Hefner

befree-utilities

v1.0.4

Published

This npm library will be of personal use. However, it can be useful for external developers as well. It will receive new features with time depending on my needs

Downloads

315

Readme

Install

npm i befree-utilities

Description

This npm library will be of personal use. However, it can be useful for external developers as well. It will receive new features with time depending on my needs

Usage

Currency manipulation
import { currencyFormatter, stripeCurrencyFormatter } from "befree-utilities";

// Description: Formats a number directly into a localized currency string
// Input example: currencyFormatter(12345.56, "USD");
// Output example: "$1, 234.56"
console.log('Result of currency formatter:', currencyFormatter(12345.56, "USD"));

// Description:  Formats a number given in the smallest currency format unit (e.g., cents) into a localized currency string
// Input example: stripeCurrencyFormatter(1234556, "USD");
// Output example: "$1, 234.56"
console.log('Result of Stripe currency formatter:', stripeCurrencyFormatter(1234556, "USD"));
Data type manipulation
import { base64toBlob } from "befree-utilities";

// Description: Converts a base64-encoded string into a binary blob and
// optionally creates a File object and a url for the blob
// Input example: const file = base64toBlob(iVBORw0KGgoAAAANSUhEUgAAAAUA...); // (truncated Base64 string for brevity)
// Output example:
// console.log(file);
// {
//   blob: Blob { size: 522, type: "" }, //  Binary blob representation
//   file: File { name: "fiename.jpg", size: 522, type: "image/jpg" }
//   url: "blob:http://example/com/abc123" // Object Url for the blob
// }

const file = base64toBlob("iVBORw0KGgoAAAANSUhEUgAAAAUA..."); // (truncated Base64 string for brevity)
console.log('Result of base64toBlob:', file);
Date manipulation
import { calculateTimeSincePublished, formatDateWithoutTime } from "befree-utilities";

// Description: Calculates the time elapsed since a given date and returns it as a human-readable string
// Input example: calculateTimeSincePublished("2024-11-28T10:00:00Z");
// Output example: "2 days ago"
console.log(calculateTimeSincePublished("2024-11-28T10:00:00Z"));

// Description: Formats a given date into a human-readable string, showing only the date without the time
// Input example: formatDateWithoutTime("2024-11-28T10:00:00Z");
// Output example: "11/28/2024" // (for en-US locale)
console.log(formatDateWithoutTime("2024-11-28T10:00:00Z"));
Object manipulation
import { checkEmptyObject } from "befree-utilities";

// Description: Checks if an object is empty (i.e., has no own properties) and returns true if it is empty, otherwise false.
// Input example:
//   checkEmptyObject({}); // Empty object
//   checkEmptyObject({ key: "value" }); // Non-empty object
// Output example:
//   true fo the empty object
//   false for the object with properties
console.log(checkEmptyObject({}));
String manipulation
import { capitalizeWordsInArray } from "befree-utilities";

// Description: Take an array of words and returns a new array where each word is capitalized
// Input example: capitalizeWordsInArray(["hello", "world", "JAVASCRIPT", ""]);
// Output example: ["Hello", "World", "Javascript"]
console.log(capitalizeWordsInArray(["hello", "world", "JAVASCRIPT", ""]))

Community

The befree-utilities community can be found on GitHub Discussions where you can ask questions and voice ideas.

beFree Utilities Author

Support Me

Dude, I'm broke. If you find this useful, please don't hesitate to help me maintain it!.

Contributing

TO UPDATE

Hire Me

I'm available to work with you guys. If you need a developer who specializes in MongoDB, Express, ReactJS/NextJS, NodeJS, Php and MySQL, then I'm you're guy!. Reach out to me at [email protected].

You can also check my portfolio at my personal blog.

Contributors

A list of co-authors that have helped improve this amazing library!

All Contributors