{"id":28569159,"url":"https://github.com/yunomisaki/ts-collections","last_synced_at":"2025-06-10T17:03:56.025Z","repository":{"id":41349192,"uuid":"508525598","full_name":"yunomisaki/ts-collections","owner":"yunomisaki","description":"A simple data structures library for TypeScript","archived":false,"fork":false,"pushed_at":"2025-05-31T15:30:31.000Z","size":7119,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T10:06:53.044Z","etag":null,"topics":["collections","enumerable","linq","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yunomisaki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-06-29T02:55:57.000Z","updated_at":"2025-04-30T11:05:59.000Z","dependencies_parsed_at":"2023-12-09T17:24:40.176Z","dependency_job_id":"223307ea-272b-4d7f-8cf7-b2902d749f67","html_url":"https://github.com/yunomisaki/ts-collections","commit_stats":null,"previous_names":["hoshixlily/ts-collections","yunomisaki/ts-collections"],"tags_count":76,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yunomisaki%2Fts-collections","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yunomisaki%2Fts-collections/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yunomisaki%2Fts-collections/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yunomisaki%2Fts-collections/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yunomisaki","download_url":"https://codeload.github.com/yunomisaki/ts-collections/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yunomisaki%2Fts-collections/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259114383,"owners_count":22807240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collections","enumerable","linq","typescript"],"created_at":"2025-06-10T17:01:48.551Z","updated_at":"2025-06-10T17:03:56.016Z","avatar_url":"https://github.com/yunomisaki.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# ts-collections\n\nA TypeScript library providing a comprehensive set of data structures with a focus on type safety and performance.\n\n## Table of Contents\n- [Installation](#installation)\n- [Data Structures](#data-structures)\n  - [List](#list)\n    - [List](#list-1)\n    - [LinkedList](#linkedlist)\n    - [CircularLinkedList](#circularlinkedlist)\n  - [Dictionary](#dictionary)\n    - [Dictionary](#dictionary-1)\n    - [SortedDictionary](#sorteddictionary)\n  - [Set](#set)\n    - [EnumerableSet](#enumerableset)\n    - [SortedSet](#sortedset)\n  - [Queue](#queue)\n    - [Queue](#queue-1)\n    - [CircularQueue](#circularqueue)\n    - [PriorityQueue](#priorityqueue)\n  - [Stack](#stack)\n    - [Stack](#stack-1)\n  - [Heap](#heap)\n    - [Heap](#heap-1)\n  - [Tree](#tree)\n    - [RedBlackTree](#redblacktree)\n  - [Lookup](#lookup)\n    - [Lookup](#lookup-1)\n  - [Observable Collections](#observable-collections)\n    - [ObservableCollection](#observablecollection)\n    - [ReadonlyObservableCollection](#readonlyobservablecollection)\n  - [Readonly Collections](#readonly-collections)\n    - [ReadonlyCollection](#readonlycollection)\n    - [ReadonlyDictionary](#readonlydictionary)\n    - [ReadonlyList](#readonlylist)\n  - [Immutable Data Structures](#immutable-data-structures)\n    - [ImmutableList](#immutablelist)\n    - [ImmutableDictionary](#immutabledictionary)\n    - [ImmutableSortedDictionary](#immutablesorteddictionary)\n    - [ImmutableSet](#immutableset)\n    - [ImmutableSortedSet](#immutablesortedset)\n    - [ImmutableQueue](#immutablequeue)\n    - [ImmutablePriorityQueue](#immutablepriorityqueue)\n    - [ImmutableStack](#immutablestack)\n- [Enumerable Support](#enumerable-support)\n\n## Installation\n\n```shell\nnpm i @mirei/ts-collections\n```\n\n## Data Structures\n\n### List\n\nLists are ordered collections that allow duplicate elements and provide index-based access.\n\n#### List\n\nA dynamic array-based implementation of a list.\n\n- **When to use**: When you need fast random access by index and efficient operations at the end of the collection.\n- **Key features**:\n  - Fast random access by index (O(1))\n  - Efficient add/remove at the end (O(1) amortized)\n  - Less efficient add/remove at arbitrary positions (O(n))\n- **Example usage**:\n\n```typescript\nconst list = new List([1, 2, 3, 4, 5]);\nlist.add(6);                // Add element at the end\nlist.addAt(0, 0);           // Add element at specific index\nlist.get(3);                // Get element at index 3\nlist.removeAt(0);           // Remove element at index 0\nlist.sort();                // Sort the list\n```\n\n#### LinkedList\n\nA doubly-linked list implementation.\n\n- **When to use**: When you need efficient insertions and deletions at both ends or in the middle of the list.\n- **Key features**:\n  - O(1) operations at both ends (add, remove)\n  - O(1) insertion/deletion after finding a position\n  - O(n) random access by index\n  - Supports queue and stack operations (addFirst, addLast, removeFirst, removeLast)\n- **Example usage**:\n\n```typescript\nconst linkedList = new LinkedList([1, 2, 3]);\nlinkedList.addFirst(0);     // Add at beginning\nlinkedList.addLast(4);      // Add at end\nlinkedList.removeFirst();   // Remove from beginning\nlinkedList.removeLast();    // Remove from end\n```\n\n#### CircularLinkedList\n\nA circular doubly-linked list implementation where the last node points to the first node and the first node points to the last node, forming a circle.\n\n- **When to use**: When you need a linked list with circular traversal capabilities or when you need to efficiently access both ends of the list.\n- **Key features**:\n  - O(1) operations at both ends (addFirst, addLast, removeFirst, removeLast)\n  - Circular structure allows wrapping around from the end to the beginning\n  - Supports efficient traversal in both directions\n  - Optimized node access by traversing from the closer end\n- **Example usage**:\n\n```typescript\nconst circularList = new CircularLinkedList([1, 2, 3]);\ncircularList.addFirst(0);     // Add at beginning\ncircularList.addLast(4);      // Add at end\ncircularList.removeFirst();   // Remove from beginning\ncircularList.removeLast();    // Remove from end\n// Get a range of elements that can wrap around the list\nconst range = circularList.getRange(2, 4);\n```\n\n### Dictionary\n\nDictionaries are collections of key-value pairs where each key is unique.\n\n#### Dictionary\n\nA hash-based implementation of a dictionary using JavaScript's Map.\n\n- **When to use**: When you need fast lookups by key and don't need the keys to be ordered.\n- **Key features**:\n  - Fast lookups, insertions, and deletions (O(1) average)\n  - Keys are not ordered\n  - Supports custom equality comparators\n- **Example usage**:\n\n```typescript\nconst dict = new Dictionary\u003cstring, number\u003e();\ndict.add(\"one\", 1);         // Add a key-value pair\ndict.put(\"two\", 2);         // Add or update a key-value pair\ndict.get(\"one\");            // Get value by key\ndict.remove(\"one\");         // Remove a key-value pair\ndict.containsKey(\"two\");    // Check if key exists\n```\n\n#### SortedDictionary\n\nA dictionary implementation that keeps keys sorted using a Red-Black Tree.\n\n- **When to use**: When you need a dictionary with keys maintained in sorted order.\n- **Key features**:\n  - Guaranteed O(log n) lookups, insertions, and deletions\n  - Keys are always sorted\n  - Supports custom key comparators\n- **Example usage**:\n\n```typescript\nconst sortedDict = new SortedDictionary\u003cnumber, string\u003e();\nsortedDict.add(3, \"three\");\nsortedDict.add(1, \"one\");\nsortedDict.add(2, \"two\");\n// Iteration will be in order: 1, 2, 3\nfor (const pair of sortedDict) {\n    console.log(pair.key, pair.value);\n}\n```\n\n### Set\n\nSets are collections of unique elements.\n\n#### EnumerableSet\n\nA set implementation based on JavaScript's Set.\n\n- **When to use**: When you need a collection of unique elements with fast lookups.\n- **Key features**:\n  - Fast lookups, insertions, and deletions (O(1) average)\n  - Elements are not ordered\n  - Supports set operations (union, intersection, difference)\n- **Example usage**:\n\n```typescript\nconst set = new EnumerableSet([1, 2, 3]);\nset.add(4);                 // Add an element\nset.contains(2);            // Check if element exists\nset.remove(1);              // Remove an element\nset.intersectWith([2, 3, 5]); // Keep only elements that are in both sets\n```\n\n#### SortedSet\n\nA set implementation that keeps elements sorted using a Red-Black Tree.\n\n- **When to use**: When you need a set with elements maintained in sorted order.\n- **Key features**:\n  - Guaranteed O(log n) lookups, insertions, and deletions\n  - Elements are always sorted\n  - Supports custom element comparators\n  - Supports range operations (headSet, tailSet, subSet)\n- **Example usage**:\n\n```typescript\nconst sortedSet = new SortedSet([3, 1, 4, 2]);\n// Iteration will be in order: 1, 2, 3, 4\nfor (const element of sortedSet) {\n    console.log(element);\n}\n// Get subsets\nconst headSet = sortedSet.headSet(3);  // Elements less than 3\nconst tailSet = sortedSet.tailSet(2);  // Elements greater than or equal to 2\n```\n\n### Queue\n\nQueues are FIFO (First-In-First-Out) collections.\n\n#### Queue\n\nA standard queue implementation using a LinkedList.\n\n- **When to use**: When you need a FIFO data structure.\n- **Key features**:\n  - O(1) operations at both ends (enqueue, dequeue)\n  - Supports peeking at the front element without removing it\n- **Example usage**:\n\n```typescript\nconst queue = new Queue([1, 2, 3]);\nqueue.enqueue(4);           // Add to the end\nconst front = queue.peek(); // Look at the front element\nconst item = queue.dequeue(); // Remove and return the front element\n```\n\n#### CircularQueue\n\nA fixed-size queue that overwrites the oldest elements when full.\n\n- **When to use**: When you need a queue with a fixed capacity that automatically removes old elements.\n- **Key features**:\n  - Fixed capacity (default 32)\n  - Automatically removes oldest elements when full\n  - O(1) operations at both ends\n- **Example usage**:\n\n```typescript\nconst circularQueue = new CircularQueue\u003cnumber\u003e(5); // Capacity of 5\nfor (let i = 0; i \u003c 10; i++) {\n    circularQueue.enqueue(i);\n}\n// Queue will contain only the 5 most recent elements: 5, 6, 7, 8, 9\n```\n\n#### PriorityQueue\n\nA queue where elements are dequeued according to priority.\n\n- **When to use**: When you need to process elements in order of priority rather than insertion order.\n- **Key features**:\n  - O(log n) insertion and removal\n  - Highest priority element is always at the front\n  - Supports custom priority comparators\n- **Example usage**:\n\n```typescript\n// Min priority queue (smallest element first)\nconst priorityQueue = new PriorityQueue\u003cnumber\u003e([3, 1, 4, 2]);\npriorityQueue.enqueue(5);\n// Elements will be dequeued in order: 1, 2, 3, 4, 5\n```\n\n### Stack\n\nStacks are LIFO (Last-In-First-Out) collections.\n\n#### Stack\n\nA standard stack implementation using a LinkedList.\n\n- **When to use**: When you need a LIFO data structure.\n- **Key features**:\n  - O(1) operations at the top (push, pop)\n  - Supports peeking at the top element without removing it\n- **Example usage**:\n\n```typescript\nconst stack = new Stack([1, 2, 3]);\nstack.push(4);              // Add to the top\nconst top = stack.peek();   // Look at the top element\nconst item = stack.pop();   // Remove and return the top element\n```\n\n### Heap\n\nA binary heap is a complete binary tree where each node's value is greater than or equal to (max heap) or less than or equal to (min heap) the values of its children.\n\n#### Heap\n\nA binary heap implementation.\n\n- **When to use**: When you need to efficiently find and remove the minimum or maximum element.\n- **Key features**:\n  - O(1) access to the minimum/maximum element\n  - O(log n) insertion and removal\n  - Supports custom comparators to create min or max heaps\n- **Example usage**:\n\n```typescript\n// Min heap (smallest element at the root)\nconst minHeap = new Heap\u003cnumber\u003e((a, b) =\u003e a - b);\nminHeap.add(3);\nminHeap.add(1);\nminHeap.add(4);\nconst min = minHeap.peek(); // Get the minimum element (1)\nminHeap.poll();             // Remove and return the minimum element\n```\n\n### Tree\n\nTrees are hierarchical data structures.\n\n#### RedBlackTree\n\nA self-balancing binary search tree implementation.\n\n- **When to use**: When you need a balanced tree for efficient lookups, insertions, and deletions.\n- **Key features**:\n  - Guaranteed O(log n) lookups, insertions, and deletions\n  - Elements are always sorted\n  - Supports custom element comparators\n- **Example usage**:\n\n```typescript\nconst tree = new RedBlackTree\u003cnumber\u003e();\ntree.insert(3);\ntree.insert(1);\ntree.insert(4);\ntree.search(1);             // Check if element exists\ntree.delete(3);             // Remove an element\n```\n\n### Lookup\n\nA lookup is a collection that maps keys to collections of values.\n\n#### Lookup\n\nA lookup implementation using a RedBlackTree.\n\n- **When to use**: When you need to group elements by a key and access all elements with a specific key.\n- **Key features**:\n  - O(log n) lookups by key\n  - Each key maps to a collection of values\n  - Supports custom key comparators\n- **Example usage**:\n\n```typescript\nconst data = [\n    { category: \"A\", value: 1 },\n    { category: \"B\", value: 2 },\n    { category: \"A\", value: 3 }\n];\nconst lookup = Lookup.create(\n    data,\n    item =\u003e item.category,\n    item =\u003e item.value\n);\nconst categoryA = lookup.get(\"A\"); // Returns collection with values 1 and 3\n```\n\n### Observable Collections\n\nObservable collections are collections that notify subscribers when changes occur.\n\n#### ObservableCollection\n\nA collection that notifies subscribers when elements are added, removed, or modified.\n\n- **When to use**: When you need to track changes to a collection and react to those changes.\n- **Key features**:\n  - Notifies subscribers when elements are added, removed, or modified\n  - Provides information about what changed (old items, new items, action type)\n  - Wraps a List for efficient operations\n- **Example usage**:\n\n```typescript\nconst collection = new ObservableCollection([1, 2, 3]);\ncollection.collectionChanged = (sender, args) =\u003e {\n    console.log(\"Collection changed:\", args.action);\n    console.log(\"New items:\", args.newItems);\n    console.log(\"Old items:\", args.oldItems);\n};\ncollection.add(4);          // Triggers collectionChanged event\ncollection.remove(2);       // Triggers collectionChanged event\ncollection.clear();         // Triggers collectionChanged event\n```\n\n#### ReadonlyObservableCollection\n\nA read-only wrapper around an ObservableCollection that forwards collection change events.\n\n- **When to use**: When you need to provide read-only access to an observable collection while still allowing subscribers to be notified of changes.\n- **Key features**:\n  - Provides read-only access to the underlying collection\n  - Forwards collection change events from the wrapped collection\n  - Prevents modification of the collection through this wrapper\n- **Example usage**:\n\n```typescript\nconst observableCollection = new ObservableCollection([1, 2, 3]);\nconst readonlyCollection = new ReadonlyObservableCollection(observableCollection);\nreadonlyCollection.collectionChanged = (sender, args) =\u003e {\n    console.log(\"Collection changed:\", args.action);\n};\n// Changes to the original collection are still observable through the readonly wrapper\nobservableCollection.add(4); // Triggers collectionChanged event on readonlyCollection\n```\n\n### Readonly Collections\n\nReadonly collections are wrappers that provide read-only access to underlying collections.\n\n#### ReadonlyCollection\n\nA wrapper around an ICollection that provides read-only access to the underlying collection.\n\n- **When to use**: When you need to provide read-only access to a collection to prevent modifications.\n- **Key features**:\n  - Provides read-only access to the underlying collection\n  - Delegates all operations to the wrapped collection\n  - Prevents modification of the collection through this wrapper\n- **Example usage**:\n\n```typescript\nconst list = new List([1, 2, 3]);\nconst readonlyCollection = new ReadonlyCollection(list);\nreadonlyCollection.contains(2);  // Returns true\n// readonlyCollection.add(4);    // Error: Method not available\n// Changes to the original collection are reflected in the readonly wrapper\nlist.add(4);\nreadonlyCollection.contains(4);  // Returns true\n```\n\n#### ReadonlyDictionary\n\nA wrapper around an IDictionary that provides read-only access to the underlying dictionary.\n\n- **When to use**: When you need to provide read-only access to a dictionary to prevent modifications.\n- **Key features**:\n  - Provides read-only access to the underlying dictionary\n  - Delegates all operations to the wrapped dictionary\n  - Prevents modification of the dictionary through this wrapper\n- **Example usage**:\n\n```typescript\nconst dict = new Dictionary\u003cstring, number\u003e();\ndict.add(\"one\", 1);\ndict.add(\"two\", 2);\nconst readonlyDict = new ReadonlyDictionary(dict);\nreadonlyDict.get(\"one\");         // Returns 1\nreadonlyDict.containsKey(\"two\"); // Returns true\n// readonlyDict.add(\"three\", 3); // Error: Method not available\n// Changes to the original dictionary are reflected in the readonly wrapper\ndict.add(\"three\", 3);\nreadonlyDict.containsKey(\"three\"); // Returns true\n```\n\n#### ReadonlyList\n\nA wrapper around an IList that provides read-only access to the underlying list.\n\n- **When to use**: When you need to provide read-only access to a list to prevent modifications.\n- **Key features**:\n  - Provides read-only access to the underlying list\n  - Delegates all operations to the wrapped list\n  - Supports index-based access\n  - Prevents modification of the list through this wrapper\n- **Example usage**:\n\n```typescript\nconst list = new List([1, 2, 3]);\nconst readonlyList = new ReadonlyList(list);\nreadonlyList.get(0);           // Returns 1\nreadonlyList.indexOf(2);       // Returns 1\n// readonlyList.add(4);        // Error: Method not available\n// Changes to the original list are reflected in the readonly wrapper\nlist.add(4);\nreadonlyList.contains(4);      // Returns true\n```\n\n### Immutable Data Structures\n\nImmutable data structures are collections that cannot be modified after they are created. Any operation that would modify the structure instead returns a new instance with the modification applied, leaving the original structure unchanged.\n\n#### ImmutableList\n\nAn immutable version of List.\n\n- **When to use**: When you need a list that cannot be modified, or when you want to ensure that a list passed to a function is not modified.\n- **Key features**:\n  - All operations that would modify the list return a new list\n  - Supports all standard list operations\n- **Example usage**:\n\n```typescript\nconst list = ImmutableList.create([1, 2, 3]);\nconst newList = list.add(4);      // Original list is unchanged\nconst filtered = list.removeIf(x =\u003e x % 2 === 0); // Returns new list with odd numbers only\n```\n\n#### ImmutableDictionary\n\nAn immutable version of Dictionary.\n\n- **When to use**: When you need a dictionary that cannot be modified, or when you want to ensure that a dictionary passed to a function is not modified.\n- **Key features**:\n  - All operations that would modify the dictionary return a new dictionary\n  - Supports all standard dictionary operations\n- **Example usage**:\n\n```typescript\nconst dict = ImmutableDictionary.create\u003cstring, number\u003e();\nconst dict2 = dict.add(\"one\", 1);  // Original dictionary is unchanged\nconst dict3 = dict2.put(\"two\", 2); // Returns new dictionary with the added key-value pair\n```\n\n#### ImmutableSortedDictionary\n\nAn immutable version of SortedDictionary.\n\n- **When to use**: When you need a sorted dictionary that cannot be modified.\n- **Key features**:\n  - All operations that would modify the dictionary return a new dictionary\n  - Keys are always sorted\n- **Example usage**:\n\n```typescript\nconst sortedDict = ImmutableSortedDictionary.create\u003cnumber, string\u003e();\nconst dict2 = sortedDict.add(3, \"three\");\nconst dict3 = dict2.add(1, \"one\");\n// Iteration will be in order: 1, 3\n```\n\n#### ImmutableSet\n\nAn immutable version of EnumerableSet.\n\n- **When to use**: When you need a set that cannot be modified.\n- **Key features**:\n  - All operations that would modify the set return a new set\n  - Supports all standard set operations\n- **Example usage**:\n\n```typescript\nconst set = ImmutableSet.create([1, 2, 3]);\nconst set2 = set.add(4);          // Original set is unchanged\nconst set3 = set2.remove(1);      // Returns new set without the element 1\n```\n\n#### ImmutableSortedSet\n\nAn immutable version of SortedSet.\n\n- **When to use**: When you need a sorted set that cannot be modified.\n- **Key features**:\n  - All operations that would modify the set return a new set\n  - Elements are always sorted\n- **Example usage**:\n\n```typescript\nconst sortedSet = ImmutableSortedSet.create([3, 1, 4, 2]);\nconst set2 = sortedSet.add(5);    // Original set is unchanged\n// Iteration will be in order: 1, 2, 3, 4, 5\n```\n\n#### ImmutableQueue\n\nAn immutable version of Queue.\n\n- **When to use**: When you need a queue that cannot be modified.\n- **Key features**:\n  - All operations that would modify the queue return a new queue\n  - Supports all standard queue operations\n- **Example usage**:\n\n```typescript\nconst queue = ImmutableQueue.create([1, 2, 3]);\nconst queue2 = queue.add(4);      // Original queue is unchanged\n// Elements will be dequeued in order: 1, 2, 3, 4\n```\n\n#### ImmutableStack\n\nAn immutable version of Stack.\n\n- **When to use**: When you need a stack that cannot be modified.\n- **Key features**:\n  - All operations that would modify the stack return a new stack\n  - Supports all standard stack operations\n- **Example usage**:\n\n```typescript\nconst stack = ImmutableStack.create([1, 2, 3]);\nconst stack2 = stack.add(4);      // Original stack is unchanged\n// Elements will be popped in order: 4, 3, 2, 1\n```\n\n#### ImmutablePriorityQueue\n\nAn immutable version of PriorityQueue.\n\n- **When to use**: When you need a priority queue that cannot be modified, or when you want to ensure that elements are processed in priority order without modifying the original collection.\n- **Key features**:\n  - All operations that would modify the queue return a new queue\n  - Elements are dequeued according to priority\n  - Supports custom priority comparators\n  - Provides both queue operations (enqueue/dequeue) and collection operations (add/remove)\n- **Example usage**:\n\n```typescript\n// Min priority queue (smallest element first)\nconst queue = ImmutablePriorityQueue.create([3, 1, 4, 2]);\nconst queue2 = queue.enqueue(5);  // Original queue is unchanged\nconst front = queue2.peek();      // Returns 1 (smallest element)\nconst queue3 = queue2.dequeue();  // Returns new queue without the highest priority element\n```\n\n## Enumerable Support\n\nAll collections in this library implement the `IEnumerable` interface, providing LINQ-like operations for querying and manipulating data.\n\n### Example Usage\n\n```typescript\nconst list = new List([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\nconst list2 = list.select(n =\u003e n * n)\n                  .takeWhile(n =\u003e n \u003c= 25)\n                  .skipWhile(n =\u003e n \u003c 10)\n                  .orderByDescending(n =\u003e n)\n                  .toList();\nconst array = list.takeLast(5).toArray();\n```\n\nYou can also use Enumerable with plain arrays.\n\n```typescript\nconst array = Enumerable.from([1, 2, 3, 4, 5])\n                        .where(n =\u003e n % 2 !== 0)\n                        .toArray();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyunomisaki%2Fts-collections","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyunomisaki%2Fts-collections","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyunomisaki%2Fts-collections/lists"}