minauth
Version:
A TypeScript library for building authentication systems on top of the Mina blockchain and other zero-knowledge proofs solutions.
14 lines • 402 B
JavaScript
import * as E from 'fp-ts/lib/Either.js';
/**
* Converts a failible string parse operation into an Either object.
*/
export const safeFromString = (ctor, onError) => (inp) => {
try {
const val = ctor(inp);
return val === undefined ? E.left(onError(undefined)) : E.right(val);
}
catch (err) {
return E.left(onError(err));
}
};
//# sourceMappingURL=either.js.map