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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@nicolastoulemont/utilities

v0.5.0

Published

Utilities functions for personal use.

Downloads

47

Readme

Utilities

This utilities functions aims to share and re-use useful typed utilities functions I came accross.

Disclaimer

This is a work in progress tool and mainly aimed at my personal use accross my projects.

Installation

npm install @nicolastoulemont/utilities
or
yarn add @nicolastoulemont/utilities

Functions

Colors

  • randomHex()
function randomHex(): string;
  • isHex()
function isHex(hex: string): boolean;
  • isRgb()
function isRgb({ r: number, g: number, b: number }): boolean;
  • hexToRgb()
function hexToRgb(hex: string): { r: number; g: number; b: number };
  • rgbToHex()
function rgbToHex({ r: number, g: number, b: number }): string;
  • colorBasedOnBg()
function colorBasedOnBg(
  bgHex: string,
  lightColor: string,
  darkColor: string
): string;

Arrays

  • flatten()
function flatten<T>(deepArray: Array<T>): Array<T>;
  • arrayToRecord()
function arrayToRecord<T extends { [key: string]: any }>(
  array: Array<T>,
  key: string
): Record<string, T>;

Other Data structures

  • Stack
const stack = new Stack<T>()
stack.push(value: T): void
stack.pop(): T
stack.peek(): T
stack.clear(): void
stack.print(): void
stack.isEmpty(): boolean
stack.reverse(stack: Stack<T>): void
stack.sort(stack: Stack<T>): void
  • Queue
const queue = new Queue<T>()
queue.enqueue(value: T): void
queue.dequeue(): T | null
queue.peek(): T | null
queue.clear(): void
queue.print(): void
queue.reverse(queue: Queue<T>): Queue<T>
  • PriorityQueue
const pq = new PriorityQueue<T>()
pq.enqueue(value: T): void
pq.dequeue(): T | null
pq.peek(): T | null
pq.clear(): void
pq.print(): void
pq.reverse(queue: Queue<T>): Queue<T>
  • LinkedList
const list = new LinkedList<T>()
list.insertFirst(data: T)
list.insertLast(data: T)
list.insertAt(data: T, index: number)
list.getAt(index: number): T | null
list.removeAt(index: number)
list.clearList()
list.getListAsArray(): Array<T>
list.printList()
  • HashTable
const hashTable = new HashTable<T>(size:number)
hashTable.insert(key:string, value: T)
hashTable.get(key:string) T | null
hashTable.remove(key:string)
  • Binary Search Tree
const bst = new BST<T>()
bst.add(value: T): void
bst.getMin(): T | null
bst.getMax(): T | null
bst.find(value: T): Node<T> | null
bst.contains(): boolean
bst.remove(value: T): Node<T> | "Tree is empty" | null

Misc

  • randomString()
function randomString(): string;

Built with

Versionning

This tool use SemVer for versioning.

Licence

MIT