UNPKG

1.02 kBSource Map (JSON)View Raw
1{"version":3,"file":"extendComponent.js","sourceRoot":"../src/","sources":["extendComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,MAAM,UAAU,eAAe,CAA4B,MAAS,EAAE,OAAsC;IAC1G,KAAK,IAAI,MAAI,IAAI,OAAO,EAAE;QACxB,IAAI,OAAO,CAAC,cAAc,CAAC,MAAI,CAAC,EAAE;YAChC,8DAA8D;YAC9D,MAAM,CAAC,MAAI,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAI,CAAC,EAAE,OAAO,CAAC,MAAI,CAAC,CAAQ,CAAC;SAC3E;KACF;AACH,CAAC","sourcesContent":["import * as React from 'react';\nimport { appendFunction } from './appendFunction';\n\n/**\n * Extends a component's lifetime methods by appending new functions to the existing lifetime functions.\n */\nexport function extendComponent<T extends React.Component>(parent: T, methods: { [key in keyof T]?: T[key] }): void {\n for (let name in methods) {\n if (methods.hasOwnProperty(name)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parent[name] = appendFunction(parent, parent[name], methods[name]) as any;\n }\n }\n}\n"]}
\No newline at end of file