Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

befree-utilities

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

befree-utilities

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

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
273
Maintainers
0
Weekly downloads
 
Created
Source

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

  • Kevin Fonseca (@kirasiris)

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 kuaf1998@gmail.com.

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

Keywords

FAQs

Package last updated on 02 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc