How would I go about replacing the string cat
with dog
in the array below?
My example below is a mix of standard js and fp-ts, was curious if there was something in the Array module that would solve this.
const animals = ['monkey','cat','lion']
const result = pipe(
animals,
A.findIndex((animal)=> animal === 'cat'),
O.matchW(
() => animals,
(index) => //Looking for fp-ts solution here
)
)
//Expected Result: ['monkey','dog','lion']