import { concreteChunkId } from "@tsplus/stdlib/collections/Chunk/definition" /** * Safely retrieve a value from a `Chunk`. * * @tsplus pipeable-index Chunk * @tsplus static Chunk.Aspects get * @tsplus pipeable Chunk get */ export function get(n: number) { return (self: Chunk): Maybe => { return !Number.isInteger(n) || n < 0 || n >= concreteChunkId(self).length ? Maybe.none : Maybe.some(concreteChunkId(self)._get(n)) } }