UNPKG

1.01 kBSource Map (JSON)View Raw
1{"version":3,"file":"appendFunction.js","sourceRoot":"../src/","sources":["appendFunction.ts"],"names":[],"mappings":";AAAA,uDAAuD;;AAEvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,MAAW;IAAE,mBAAmB;SAAnB,UAAmB,EAAnB,qBAAmB,EAAnB,IAAmB;QAAnB,kCAAmB;;IAC7D,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;QACxB,OAAO,SAAS,CAAC,CAAC,CAAe,CAAC;KACnC;IAED,OAAO;QAAC,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACpB,SAAS,CAAC,OAAO,CAAC,UAAC,CAAa,IAAK,OAAA,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,EAA1B,CAA0B,CAAC,CAAC;IACnE,CAAC,CAAC;AACJ,CAAC;AARD,wCAQC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Returns a single function which will call each of the given functions in the context of the\n * parent.\n */\nexport function appendFunction(parent: any, ...functions: any[]): () => void {\n if (functions.length < 2) {\n return functions[0] as () => void;\n }\n\n return (...args: any[]): void => {\n functions.forEach((f: () => void) => f && f.apply(parent, args));\n };\n}\n"]}
\No newline at end of file