paulmillr / scure-base

Secure, audited & 0-deps implementation of bech32, base64, base32, base16 & base58
https://paulmillr.com/noble/#scure
MIT License
120 stars 13 forks source link

Refine: branchless chain #26

Closed imcotton closed 1 year ago

imcotton commented 1 year ago

Taking id as mempty of Monoid.

imcotton commented 1 year ago

btw, the following also works, point-free and more clean.

const encode = args.map((i: any) => i.encode).reduceRight(wrap, id) as any;
const decode = args.map((i: any) => i.decode).reduce(wrap, id) as any;