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

@osumi/tools

v1.5.0

Published

Tools to be used on Angular projects.

Downloads

82

Readme

Osumi Tools

Set of tools, little functions, to help the development of frontend projects (tried on Angular, but I guess it could work anywhere).

These are the available functions:

  • addDays: Function to add a number of days to a given Date object.
  • bytesToSize: Function to get a human readable size from an amount of bytes.
  • capitalize: Function to capitalize the first letter of a string.
  • convertRange: Function to convert a value in a range (i.e. hexadecimal value) to a value in a new range (i.e. decimal).
  • formatNumber: Function to format a given number to a string with the given decimal amount.
  • getCurrentDate: Returns current date as a string compatible with MySQL.
  • getDate: Formats a given date according to the specified configuration or returns the formatted date directly.
  • getDateFromString: Get a Date object from a date in a string.
  • getRandomNumber: Get a random number from a range (min, max).
  • getStringFromDate: Get a string representation of a Date object.
  • getTwoNumberDecimal: Format a number with 2 decimals.
  • hexToRgbFloat: Function to get the numerical values of an hexadecimal color value (i.e. FF0000 -> {r: 1, g: 0, b: 0}
  • toNumber: Function to format a given string to a number.
  • urldecode: Function to decode a previously encoded string. Returns null if null is given.
  • urlencode: Function to safely URLEncode a string. Returns null if null is given.
  • validateEmail: Function to validate the correct structure of an email address.

These are a small collection of useful tools I have needed from time to time, from a project to another, and I collected them on a library so it can be easily included and used. Every function has its JSDoc explaining what it takes and returns and tests are included.

For example, you just need to include it on your package.json:

  "dependencies": {
    "@osumi/tools": "^1.5.0",
  }

Then in a component you just import and use them:

import { urldecode } from "@osumi/tools";

const decoded: string = urldecode(result.name);

2024 Iñigo Gorosabel