Hyperlinkv0.8.0-beta.28

Chunk

Chunk.rangeconsteffect/Chunk.ts:2526
(start: number, end: number): NonEmptyChunk<number>

Creates a non-empty Chunk of consecutive integers from start through end, inclusive.

Details

If start is greater than end, returns a single-element chunk containing start.

Example (Creating a range)

import { Chunk } from "effect"

const chunk = Chunk.range(1, 5)
console.log(Chunk.toArray(chunk)) // [1, 2, 3, 4, 5]
constructors
Source effect/Chunk.ts:25262 lines
export const range = (start: number, end: number): NonEmptyChunk<number> =>
  start <= end ? makeBy(end - start + 1, (i) => start + i) : of(start)