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

@keeex/js-utils

v6.25.0

Published

Various utility functions for pure JavaScript

Downloads

46

Readme

@keeex/js-utils

Bugs Code Smells Maintainability Rating Security Rating Vulnerabilities Technical Debt

Utility functions in pure JS used in many places.

You should check the API documentation for detailed informations about each functions. This is a general feature list overview.

Async utility

  • AsyncTrigger, for easy debouncing
  • DeferredPromise to manipulate the usual resolve() and reject() functions outside of a promise block
  • KeyCache to create a basic key-value cache with asynchronous fetch
  • TimeCache to create a cache that keeps a value for a given amount of time and can automatically refresh it
  • Queues to create parallel queues of tasks

Marshalling

Serialization of random data into byte buffers.

Types

Various type-checking helpers to create TypeScript type predicates. Supports "shortcut" versions for performance after a full check was done.

Array

Generic operations on arrays, as well as array coercion.

Uint8Array and ArrayBuffer

Conversion between different formats and search in buffer functions.

base58, base64

Utility to manipulate strings encoded in these formats.

benchmark

Code to run a JavaScript function a lot to get performance benchmarks. Includes some form of "automatic" probing to get good average values.

bytebuffer

Helper wrapping JavaScript DataView into convenient functions.

dict

Functions to copy records with primitive types (deep copy).

error

Coerce anything (unknown) into an Error object for easier error handling.

global

Functions to use a JavaScript environment "global" dataset. Handles multiple environment somewhat gracefully.

idx

IDX check and manipulation functions

json

JSON parsing with type safety. Also, a "canonical" JSON encoder that ensure property order is consistent.

log

Generic logging functionality. Supports various log level, timestamping, error chaining, stacktrace stripping.

number

Manipulate number. Currently only round to a given decimal place.

path

Generic filename sanitization.

promise

Helpers around promises.

  • controlled async delay
  • retry a promise until it succeed (with max tries)
  • run an array of promise, stop at the first that succeed

starttime

Get the elapsed time since the JavaScript environment started.

string

String and UTF-8 manipulations.

units

Convers between various units. Generic functions are available as well as byte and time conversions.