UNPKG

1.07 kBSource Map (JSON)View Raw
1{"version":3,"file":"hoistStatics.js","sourceRoot":"../src/","sources":["hoistStatics.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAEH,SAAgB,YAAY,CAAgC,MAAe,EAAE,IAAW;IACtF,KAAK,IAAM,MAAI,IAAI,MAAM,EAAE;QACzB,IAAI,MAAM,CAAC,cAAc,CAAC,MAAI,CAAC,EAAE;YAC/B,8DAA8D;YAC7D,IAAY,CAAC,MAAI,CAAC,GAAG,MAAM,CAAC,MAAI,CAAC,CAAC;SACpC;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AATD,oCASC","sourcesContent":["/**\n * Allows you to hoist static functions in components.\n * Created for the purpose of fixing broken static functions in classes\n * that utilize decorators.\n *\n * @public\n * @param source - The object where the methods are hoisted from.\n * @param dest - The object to hoist the methods onto.\n * @returns The dest object with methods added\n */\n\nexport function hoistStatics<TSource extends Object, TDest>(source: TSource, dest: TDest): TDest {\n for (const name in source) {\n if (source.hasOwnProperty(name)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (dest as any)[name] = source[name];\n }\n }\n\n return dest;\n}\n"]}
\No newline at end of file