Skip to main content
Module

x/fae/lensIndex.ts>lensIndex

A functional module for Deno inspired from Ramda.
Latest
variable lensIndex
import { lensIndex } from "https://deno.land/x/fae@v1.1.1/lensIndex.ts";

Returns a lens whose focus is the specified index.

 const headLens = Fae.lensIndex(0)
 Fae.view(headLens, ['a', 'b', 'c'])            // 'a'
 Fae.set(headLens, 'x', ['a', 'b', 'c'])        // ['x', 'b', 'c']
 Fae.over(headLens, (x: string) => x.toUpperCase(), ['a', 'b', 'c']) // ['A', 'b', 'c']

type

LensIndex