https://github.com/anonymousrecords/type-safe-array
TypeSafeArray is a type-safe utility library for array manipulation in TypeScript.
https://github.com/anonymousrecords/type-safe-array
Last synced: about 1 year ago
JSON representation
TypeSafeArray is a type-safe utility library for array manipulation in TypeScript.
- Host: GitHub
- URL: https://github.com/anonymousrecords/type-safe-array
- Owner: anonymousRecords
- License: mit
- Created: 2024-08-14T06:41:56.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-21T09:11:29.000Z (almost 2 years ago)
- Last Synced: 2025-03-24T03:42:05.480Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://type-safe-array-docs.vercel.app
- Size: 7.08 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# TypeSafeArray
TypeSafeArray is a type-safe utility library for array manipulation in TypeScript.
## Features
- Full type safety
- Support for readonly arrays
- API similar to standard Array methods
## Installation
```bash
npm install @chapdo/type-safe-array
```
or
```bash
yarn add @chapdo/type-safe-array
```
## Usage
```typescript
import { TypeSafeArray } from 'type-safe-array';
const numbers = [1, 2, 3, 4, 5] as const;
// map example
const doubled = TypeSafeArray.map(numbers, (x) => x * 2);
console.log(doubled); // [2, 4, 6, 8, 10]
// filter example
const evenNumbers = TypeSafeArray.filter(numbers, (x) => x % 2 === 0);
console.log(evenNumbers); // [2, 4]
// reduce example
const sum = TypeSafeArray.reduce(numbers, (acc, curr) => acc + curr, 0);
console.log(sum); // 15
```
## Official Documentation
Detailed API documentation can be found [here](https://type-safe-array-docs.vercel.app/).
## License
This project is under the [MIT License](LICENSE).