paulmillr / scure-base

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

Refine: branchless chain #26

Closed imcotton closed 9 months ago

imcotton commented 9 months ago

Taking id as mempty of Monoid.

imcotton commented 9 months 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;