class Mutant::Transform::Array
Transform an array via mapping it over transform
def call(input)
-
(Either
->)
Parameters:
-
input
(Object
) --
def call(input) PRIMITIVE .call(input) .lmap(&method(:lift_error)) .bind(&method(:run)) end
def run(input)
def run(input) output = [] input.each_with_index do |value, index| output << transform.call(value).lmap do |error| return failure( error( cause: Index.wrap(error, index), message: MESSAGE % { index: }, input: ) ) end.from_right end success(output) end