๐Ÿš€ Quick Start

 

๐Ÿš€ Quick Start Guide: @fizzwiz/sorted

Welcome to @fizzwiz/sorted — a modern library of sorted collections for JavaScript.
This guide will help you get started in just a few minutes.


๐Ÿ“ฆ Installation

Install with npm:

npm install @fizzwiz/sorted

Or with yarn:

yarn add @fizzwiz/sorted

๐Ÿ” Basic Sorting

The ArrayQueue class keeps elements sorted by insertion order — behaving like a FIFO or LIFO queue, depending on configuration:

import { ArrayQueue } from '@fizzwiz/sorted';

// LIFO (Last In, First Out)
const lifo = new ArrayQueue(false).let(1).let(2).let(3);

const last = lifo.peek(); // → 3

๐Ÿง  Advanced Equivalence

Use custom equivalence logic via representation functions. For example, group strings by their length:

import { TrueSet, ORDER } from '@fizzwiz/sorted';

const set = new TrueSet(
  word => word.length,       // representation function
  ORDER.ASCENDING, 
  ORDER.SINGULAR             // enforce uniqueness by representation
);

set.add("what");
set.add("that"); // → false (same length as "what")

๐Ÿงช Composable Logic

Collection extends the Each concept (see @fizzwiz/fluent Blog) — allowing fluent, chainable transformations:

const lifo = new ArrayQueue(false).let(1).let(2).let(3);

const odds = lifo.which(i => i % 2 === 1);     // → [1, 3]
const sum = odds.what((a, b) => a + b);        // → 4

๐Ÿ“š Explore More

 Intro to the Library

A conceptual overview of the design philosophy and patterns behind @fizzwiz/sorted.

๐Ÿ“„ API Reference

Browse the full, auto-generated documentation.

๐Ÿงพ GitHub Repository

View the source, report issues, or contribute to the project.


๐Ÿ’ฌ Need Help?

Questions? Thoughts? Drop a comment on the blog or open a discussion on GitHub.

“Make your code align with your thoughts.”
 @fizzwiz ✨

Comments

Popular posts from this blog

๐Ÿง  Contemplating a True Set

๐Ÿงฑ v0.0.0-dev.1 — First Brick