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

uty

v0.1.0

Published

utilities for common tasks

Downloads

124

Readme

test  npm  shaking

Install

npm i uty

Overview

:small_blue_diamond: Collection Interactions

Helpers for working with arrays and objects, providing functions for data extraction and manipulation.

import { pluck } from 'uty/collect';

pluck('name', 'detail.date', [
  { name: 'Albert', detail: { date: 1879 } },
  { name: 'Isaac', detail: { date: 1643 } },
]);

//=> {1879: 'Albert', 1643: 'Isaac'}

:small_blue_diamond: Define Hub

A set of consistent values used throughout the application to maintain clarity and reduce redundancy.

import { MAX_SAFE_INTEGER, RGX_WHITESPACE } from 'uty/define';

console.log(MAX_SAFE_INTEGER); //=> 9007199254740991
console.log(RGX_WHITESPACE); //=> /^\s*$/

:small_blue_diamond: Event Listeners

A simple, customizable event system for handling and emitting events.

import { event } from 'uty/event';

const bus = event();

bus.on('tick', number => {
  console.log(number);
});

bus.emit('tick', 1);
//=> 1

:small_blue_diamond: Helpers

Commonly used utility functions that streamline coding patterns and reduce repetitive tasks.

import { pipe } from 'uty';
import { divisible, add, sum } from 'uty/math';

const total = pipe(divisible(2), add(10), sum);

total([1, 2, 3, 4, 5]);
//=> 26

await total(Promise.resolve([6, 7, 8, 9, 10]));
//=> 54

:small_blue_diamond: Type and Value Checks

Provides functions to assess variable types, compare values, and gather information about the system environment.

import { isArrayLike, isEqual } from 'uty/is';

isArrayLike('fruits'); //=> true

isEqual([1, 2, 3], [1, 2, 3, 4]); //=> false

:small_blue_diamond: Mathematical Operations

Efficient tools for a wide range of mathematical calculations designed to simplify number handling and analysis.

import { avg } from 'uty/math';

avg('pages', [
  { name: 'Les Miserables', pages: 176 },
  { name: 'My Left Foot', pages: 1096 },
]);
//=> 636

:small_blue_diamond: String Tools

Utility functions for easy and efficient string manipulation and formatting.

import { ucfirst, ucwords } from 'uty/string';

ucfirst('uty is simple'); //=> Uty is simple
ucwords('uty is simple'); //=> Uty Is Simple

:small_blue_diamond: Data Transformation

Converts data types and structures, making it easy to switch between arrays, objects, and other formats.

import { toArray } from 'uty/to';

toArray({ first: 'Lionel', middle: 'Andrés', last: 'Messi' });
//=> ['Lionel', 'Andrés', 'Messi']

:small_blue_diamond: Type Utilities

Advanced type-checking and utilities to ensure safe operations.

import type { Include } from 'uty/type';

function isArray<T>(value: T): value is Include<T, unknown[] | Readonly<unknown[]>> {
  return Array.isArray(value);
}

Documentation

Visit our documentation for detailed guides and references.


All notable changes to this project will be documented in the changelog.

MIT