conditional-chain icon indicating copy to clipboard operation
conditional-chain copied to clipboard

what is "chain" for?

Open dberardo-com opened this issue 11 months ago • 0 comments

here i tried to tyepscript the whole:

const cond = <T = any>(chain: T) => ({
          if(condition: boolean, thanF: (obj?: T) => T, elseF?: (obj?: T) => T) {
            return cond(condition ? thanF(chain) : elseF ? elseF(chain) : chain);
          },
          chain(f: any) {
            return cond(f(chain));
          },
          end() {
            return chain;
          }
      })

what is the "chain" function for ?

dberardo-com avatar Mar 14 '25 11:03 dberardo-com