@praha/byethrow
    Preparing search index...

    Function map

    Applies a transformation function to the success value of a Result or ResultAsync. If the input is a Failure, it will be returned unchanged.

    The input Result or ResultAsync.

    The transformed success value type.

    import { Result } from '@praha/byethrow';

    const result = Result.pipe(
    Result.succeed(2),
    Result.map((x) => x * 10),
    );
    // { type: 'Success', value: 20 }
    import { Result } from '@praha/byethrow';

    const result = Result.pipe(
    Result.fail('error'),
    Result.map((x) => x * 10),
    );
    // { type: 'Failure', error: 'error' }

    pipe - It is recommended to use this function with the pipe function for better readability and composability.