Always in Sync
Synchronized with Laravel 12.x. When Laravel adds methods or fixes bugs, we update. Not a one-time port.
Always in sync with Laravel. TypeScript-first. Modern.
Alpha Release
This package is in alpha and under active development. APIs may change before the 1.0.0 stable release. Not recommended for production use yet.
A living synchronization with Laravel Collections.
laravelCollectionVersion: 12.43 in package.jsonWhen Laravel adds new methods, we add them. When bugs are fixed upstream, we fix them.
npm install collect-tspnpm add collect-tsyarn add collect-tsnpx jsr add @ovdlinden/collect-tsimport { collect } from 'collect-ts'
const result = collect([1, 2, 3, 4, 5])
.filter(n => n > 2)
.map(n => n * 2)
.sum()
// => 24Process millions of items without loading everything into memory:
import { lazy } from 'collect-ts'
const result = lazy(hugeDataset)
.filter(item => item.active)
.map(item => item.id)
.take(100)
.all()
// Only processes what's neededNot JavaScript with types bolted on. Real TypeScript with advanced patterns:
// Type-safe property extraction
const names = collect(users).pluck('name') // Collection<string>
// Higher-order messaging with full typing
const emails = collect(users).map.email // Collection<string>
// Conditional types that infer correctly
const flat = collect([[1, 2], [3, 4]]).collapse() // Collection<number>Choose your path: