1.4.8 • Published 8 months ago

@lucania/toolbox v1.4.8

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
8 months ago

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.
1.2.0

11 months ago

1.1.1

11 months ago

1.1.0

1 year ago

1.4.6

8 months ago

1.4.5

10 months ago

1.4.4

10 months ago

1.4.3

10 months ago

1.4.2

10 months ago

1.4.1

10 months ago

1.4.0

11 months ago

1.3.1

11 months ago

1.3.0

11 months ago

1.1.2

11 months ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.4.8

8 months ago

1.4.7

8 months ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago