@elijahjcobb/prototypes

A collection of helpful classes to manage various real world things in TypeScript.

Usage no npm install needed!

<script type="module">
  import elijahjcobbPrototypes from 'https://cdn.skypack.dev/@elijahjcobb/prototypes';
</script>

README

Prototypes

A collection of helpful classes to manage various real world things in TypeScript.

Classes

Class Description
ECPrototypesAddress A class representing a physical street address.
ECPrototypesByteSize A class representing a byte size.
ECPrototypesByteSizeUnit A enum representing a byte size unit.
ECPrototypesColor A class representing a color.
ECPrototypesCoordinate A class representing a GPS coordinate.
ECPrototypesDate A class representing a date.
ECPrototypesFile A class representing a file.
ECPrototypesMime A class representing a file mime.
ECPrototypesRegex A helper class providing regex tests.
ECPrototypesTimeInterval A class representing a time interval.
ECPrototypesTimeUnit A enum representing units of time.
ECPrototypesWait A helper class to synchronously wait a time interval.

Full Documentation

Source Code

If you want to poke around the source code for fun it is all located in the ts directory.

TypeScript Declaration Files

I have completely documented everything. In the table at the top each link on class each names directs to the declaration file for the class on GitHub. By installing with NPM you will also get all my type files.

Import

All the structures are packages on @elijahjcobb/prototypes. Just import it like normal and you can use any structure of the package.

All Together

import ECPrototypes = require("@elijahjcobb/prototypes");
let color: ECPrototypes.ECPrototypesColor;

Separate

import { ECPrototypesColor } from "@elijahjcobb/prototypes";
let color: ECPrototypesColor;

Generics

Yes, literally everything is generic. I wrote this for a huge project and made sure everything I made was generic.

Error Handling

Most classes throw errors when you do something that is a "no-no". This package is using a error handling package of mine called error. Check out the package @elijahjcobb/error for all the documentation. Any errors will be thrown as an instance of an ECErrorStack.

Bugs

If you find any bugs please create an issue on GitHub or if you are old fashioned email me at elijah@elijahcobb.com.