https://github.com/hoshixlily/ts-collections
A simple data structures library for TypeScript
https://github.com/hoshixlily/ts-collections
collections enumerable linq typescript
Last synced: over 1 year ago
JSON representation
A simple data structures library for TypeScript
- Host: GitHub
- URL: https://github.com/hoshixlily/ts-collections
- Owner: hoshixlily
- License: mit
- Created: 2022-06-29T02:55:57.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-27T02:34:13.000Z (over 1 year ago)
- Last Synced: 2025-03-27T02:40:01.996Z (over 1 year ago)
- Topics: collections, enumerable, linq, typescript
- Language: TypeScript
- Homepage:
- Size: 6.78 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
A simple TypeScript library for basic data structures.
## Installation
````shell
npm i @mirei/ts-collections
````
## Available Collections
* List
* List
* LinkedList
* Set
* EnumerableSet
* SortedSet
* Dictionary
* Dictionary
* SortedDictionary
* Queue
* Stack
_**To be updated with details...**_
## Enumerable Support
### Example Usage
````typescript
const list = new List([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
const list2 = list.select(n => n * n).takeWhile(n <= 25).skipWhile(n < 10).orderByDescending(n => n).toList();
const array = list.takeLast(5).toArray();
````
You can also use Enumerable with plain arrays.
````typescript
const array = Enumerable.from([1, 2, 3, 4, 5]).where(n => n % 2 !== 0).toArray();
````