@elijahjcobb/collections

A collection of generic structures written in TypeScript.

Usage no npm install needed!

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

README

Collections

A collection of generic structures written in TypeScript.

Classes

Class Description
ECArray An immutable generic class representing a list of values.
ECArrayList A mutable generic class representing a list of values.
ECDictionary An immutable generic class representing a group of key value pairs.
ECMap A mutable generic class representing a group of key value pairs.
ECIterator A generic iterator to iterate through provided values.
ECCSV A helper class to generate a CSV endoded string from an ECArray instance.
ECEnum A helper class to generate both ECArray and ECArrayList instances from a typescript enum .
ECQueue A mutable generic class representing a queue.
ECStack A mutable generic class representing a stack.

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/collections. Just import it like normal and you can use any structure of the package.

All Together

import ECCollections = require("@elijahjcobb/collections");
let array: ECCollections.ECArray<any>;

Separate

import { ECArray } from "@elijahjcobb/collections";
let array: ECArray;

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.