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

@irony0901/format

v0.1.3

Published

format functions

Downloads

3

Readme

irony Format


My collection of useful JavaScript utilities.

Features

  • Typescript
  • Steady update

Download

To install ironyFormat, use yarn

$ yarn add @irony0901/format

Methods

createUuid

createUuid( option: CreateUuidOption )


CreateUuidOption

  • length: number
    The number of letters of the output
  • prefix?: string
    The prefix of the output
  • suffix?: string
    The suffix of the output

Examples

import { createUuid } from '@irony0901/format';

const example_1 = createUuid({ length: 24 });
const example_2 = createUuid({ length: 24, prefix: 'PRODUCT-' });
const example_3 = createUuid({ length: 24, suffix: ':USER' });
const example_4 = createUuid({ length: 24, prefix: 'PRODUCT-', suffix: ':USER' });
const example_5 = createUuid({ length: 3, prefix: 'PRODUCT-' });
const example_6 = createUuid({ length: 3, suffix: ':USER' });

console.log( example_1 ) // '4b0ab5ca4c2940a08002ce3c' **length is 24**
console.log( example_2 ) // 'PRODUCT-02ebdf8ff8a54862' **length is 24**
console.log( example_3 ) // 'PRODUCT-643082bba30:USER' **length is 24**
console.log( example_4 ) // '3fa6219b5290474392b:USER' **length is 24**
console.log( example_5 ) // 'PRO' **length is 3**
console.log( example_6 ) // ':US' **length is 3**

numberTodataSize

numberTodataSize( size: number )

Examples

import { numberTodataSize } from '@irony0901/format';

const kbSize = 1024;
const mbSize = kbSize * 1024;
const gbSize = mbSize * 1024;
const tbSize = gbSize * 1024;
const pbSize = tbSize * 1024;
const exceed = pbSize * 1024;

console.log( numberTodataSize(kbSize) ) // '1.00 KB'
console.log( numberTodataSize(mbSize) ) // '1.00 MB'
console.log( numberTodataSize(gbSize) ) // '1.00 GB'
console.log( numberTodataSize(tbSize) ) // '1.00 TB'
console.log( numberTodataSize(pbSize) ) // '1.00 PB'
console.log( numberTodataSize(exceed) ) // '1024.00 PB'

hideText

hideText( option: HideTextOption )


HideTextOption

  • text: string
    Input string
  • excludeLength: number
    String numbers that will not be erased
  • start?: 'left'|'right'
    Starting cursor position.
    default value 'left'
  • hideChar?: string
    Characters to replace

Examples

import { hideText } from '@irony0901/format';

const text = 'PRODUCT-02ebdf8ff8a54862'
console.log( hideText({ text, excludeLength: 8 }) )  // 'PRODUCT-________________'
console.log( hideText({ text, hideChar: '*', excludeLength: 8 }) ) // 'PRODUCT-****************'
console.log( hideText({ text, hideChar: '#', start: 'right', excludeLength: 8 }) ) // '################f8a54862'

equals

equals( a: any, b: any )


Examples

import { equals } from '@irony0901/format';

const objA = { id: 1, name: 'irony' }
const objB = { id: 1, name: 'irony' }
const objC = { name: 'irony', id: 1 }
const arrA = [ 1, 2, 3 ]
const arrB = [ 1, 2, 3 ]
const arrC = [ 3, 2, 1 ]

console.log( objA === objB ) // objA and objB is false
console.log( JSON.stringify(objA) === JSON.stringify(objB) ) // objA and objB is true
console.log( JSON.stringify(objA) === JSON.stringify(objC) ) // objA and objC is false
console.log( equals(objA, objC) ) // objA and objC is true
console.log( equals(arrA, arrB) ) // arrA and arrB is true
console.log( equals(arrA, arrC) ) // arrA and arrC is false
console.log( equals(1, 1) ) // is true
console.log( equals(1, '1') ) // is false

parseTel

Use this instead

License

MIT