MCPcopy Create free account
hub / github.com/Effect-TS/effect / init

Function init

packages/effect/src/Array.ts:1235–1238  ·  view source on GitHub ↗
(self: Iterable<A>)

Source from the content-addressed store, hash-verified

1233 * @since 2.0.0
1234 */
1235export function init<A>(self: Iterable<A>): Option.Option<Array<A>> {
1236 const as = fromIterable(self)
1237 return isReadonlyArrayNonEmpty(as) ? Option.some(initNonEmpty(as)) : Option.none()
1238}
1239
1240/**
1241 * Returns all elements except the last of a `NonEmptyReadonlyArray`.

Callers

nothing calls this directly

Calls 3

initNonEmptyFunction · 0.85
someMethod · 0.80
fromIterableFunction · 0.70

Tested by

no test coverage detected