Skip to content

Commit

Permalink
remove prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatiusmb committed Apr 21, 2023
1 parent bb9addc commit 9b952f0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/lambda/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ export { default as pipe } from './pipe.js';

function error(msg?: string) {
const error = msg || '';
return { $kind: 'error' as const, error };
return { kind: 'error' as const, error };
}
function success<T>(value: T) {
return { $kind: 'success' as const, value };
return { kind: 'success' as const, value };
}

type Result<T> = ReturnType<typeof error> | ReturnType<typeof success<T>>;
Expand Down Expand Up @@ -40,11 +40,11 @@ export const mask = {
export function reveal<T>(opt: Result<T>) {
return {
expect(message: string) {
if (opt.$kind === 'success') return opt.value;
if (opt.kind === 'success') return opt.value;
throw new Error(message);
},
or(fallback: T): T {
return opt.$kind === 'success' ? opt.value : fallback;
return opt.kind === 'success' ? opt.value : fallback;
},
};
}

0 comments on commit 9b952f0

Please sign in to comment.