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

@lucania/toolbox

v1.0.21

Published

A utility library delivering many quality of life improvements to both browser and node environments.

Downloads

132

Readme

A JavaScript/TypeScript Toolbox

A utility library delivering many quality of life improvements to both browser and node environments.

This project has 3 sections.

  • Shared - @lucania/toolbox/shared - Contains general features purely for manipulating data and works irrespective of environment, I.E. runs in both the client and server.
  • Server - @lucania/toolbox/server - Contains features to aid in server-side development and requires a node environment to run. Do not import this library in your client-side codebase.
  • Client - @lucania/toolbox/client - Contains features to aid in client-side development and requires a browser environment to run. Do not import this library in your server-side codebase.

Getting started

Install the package

This project uses NPM, thus can be installed with...

npm install --save @lucania/toolbox

Use the libraries

Example usage of the "Shared" library.

// "Shared" currently exports 3 namespaces
import { Data, Error, Text } from "@lucania/toolbox/shared";

// Example usage of functions from the "Data" namespace.
const weatherReport = {
    weather: {
        type: "sunny",
        temperature: 21
    }
}
const weatherType = Data.get(weatherReport, "weather.type", "unknown");
Data.assert(weatherType === "sunny", "The weather is too bad to go shopping!");

// Example usage of functions from the "Error" namespace.
throw new Error.Fatal("Something unrecoverably bad happened!");

// Example usage of functions from the "Text" namespace.
const women = ["Catherine", "Kathryn"];
const distance = Text.getLevenshteinDistance(women[0], women[1]);
const message = `${Text.toPrettyList(women)} have names that sound the same, but differ by ${distance} characters in spelling!`;

// See inline documentation for more usage details and to see what is available.

Example usage of the "Server" library.

import { ConsoleColor, File } from "@lucania/toolbox/server";

// Example usage of functions from the "ConsoleColor" namespace.
const { red, green, blue, reset } = ConsoleColor.Common;
console.log(`Unpopular opinion, I prefer my computer without ${red}R${green}G${blue}B${reset}.`);

// Example usage of functions from the "File" namespace.
let fiona = await File.read("C:/Fiona Dossier.txt", "utf8");
fiona = fiona.replaceAll("life", "death");
await File.write("C:/Fiona Dossier.txt", fiona, "utf8");

/** {@link https://pastebin.com/E8af0zei Fiona Dossier} */

Example usage of the "Client" library.

import { Network, Dom, Cookies  } from "@lucania/toolbox/client";

// I got tired, so gave up on this section. I'll get to it... eventually.
// Just look at the source...

| :warning: | This project uses subpath exports only supported in Node v12.7.0+. Ensure you use one of Node's new module resolution strategies, I.E. NodeNext. | |-|:-|