Package: effect
Module: Array
Creates a NonEmptyArray containing a value repeated n times.
When to use
Use when you need a non-empty array containing repeated copies of one value.
Details
n is normalized to an integer greater than or equal to 1, so this function
always returns at least one element. Supports both data-first and data-last
usage.
Example (Repeating a value)
import { Array } from "effect"
const result = Array.replicate("a", 3)
console.log(result) // ["a", "a", "a"]
See
makeBy — vary values based on indexSignature
declare const replicate: { (n: number): <A>(a: A) => NonEmptyArray<A>; <A>(a: A, n: number): NonEmptyArray<A>; }
Since v2.0.0