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

fnlib

v1.0.2

Published

JavaScript Library of Functions

Readme

fnlib

Simple library of JavaScript Node functions.

Install

npm i fnlib


functions

strToHex

strToHex

import fnlib from 'fnlib'

console.log ('Hex:', fnlib.strToHex('foobar') )
// Hex:  66 6f 6f 62 61 72

console.log ('Hex:', fnlib.hexToStr( fnlib.strToHex('foobar') ))
// Hex:  foobar

strToBinary

binaryToStr

import fnlib from 'fnlib'

console.log ('Binary: ', fnlib.strToBinary('foobar') )
// Binary:  1100110 1101111 1101111 1100010 1100001 1110010

console.log ('Binary: ', fnlib.binaryToStr( fnlib.strToBinary('foobar') ))
// Binary:  foobar

strToBase64

base64ToStr

import fnlib from 'fnlib'

console.log ('Base64: ', fnlib.strToBase64('foobar') )
// Base64:  Zm9vYmFy

console.log ('Base64: ', fnlib.base64ToStr( fnlib.strToBase64('foobar')) )
// Base64:  foobar

strToEscape

escapeToStr

import fnlib from 'fnlib'

console.log ('Escape: ', fnlib.strToEscape('var x = foobar') )
// Escape:  var%20x%20%3D%20foobar

console.log ('Escape: ', fnlib.escapeToStr( fnlib.strToEscape('var x = foobar') ))
// Escape:  var x = foobar

capitalizeFirstLetter

import fnlib from 'fnlib'

console.log('First Name:,' fnlib.capitalizeFirstLetter('foo') )
// Foo

console.log('Last Name :,'fnlib.capitalizeFirstLetter('bar') )
// Bar

formatBytes

import fnlib from 'fnlib'
import os from 'os'

console.log('Memory:', fnlib.formatBytes( os.totalmem() ))
// Memory: 32 GB

sleep

import fnlib from 'fnlib'

await sleep(5000)

getTimeRemaining

getTimeSince

import fnlib from 'fnlib'

const startTime = new Date(Date.now())
await sleep(2000)
console.log( fnlib.getTimeSince(startTime) )
// { total: 2000, years: 0, days: 0, hours: 0, minutes: 0, seconds: 2 }

const endTime = new Date(Date.now() + 1000 * 60 )
console.log( fnlib.getTimeRemaining( endTime) )
// { total: 60000, years: 0, days: 0, hours: 0, minutes: 1, seconds: 0 }

getTimeDrift

import fnlib from 'fnlib'

console.log(  fnlib.getTimeDrift('1/1/1980', '1/1/2000') )
console.log(  fnlib.getTimeDrift('1/1/2000', '1/1/1980') )

isLeapYear

import fnlib from 'fnlib'

console.log( fnlib.isLeapYear(2000) )
// true
console.log( fnlib.isLeapYear(2001) )
// false

randomStr

randomBase64

randomHex

randomUUID

import fnlib from 'fnlib'

console.log( fnlib.randomStr(12) )
// 5g9SVAjliv6a

console.log( fnlib.randomBase64(24) )
// XlT2ovdDviop95Oe2ylYPoA/

console.log( fnlib.randomHex(32) )
// 49a92151cd290d1c7b950c4c433ae14e

console.log( fnlib.randomUUID() ) // v4 uuid
// aadb52c8-9baa-4de8-a1f2-1cbb8ca51dfe

geAge

import fnlib from 'fnlib'

console.log(  fnlib.getAge('1/1/1980', '1/1/2000') )
console.log(  fnlib.getAge('1/1/2000', '1/1/1980') )