The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/patch-injection/src/getFunctionPatches.ts

15 lines
506 B

import { calledFunctions, functions } from './data';
import type { BaseFunction, PatchData } from './definition';
export const getFunctionPatches = <T extends BaseFunction>(baseFunction: T): Set<PatchData<T>> => {
if (calledFunctions.has(baseFunction)) {
throw new Error('Patching a function that was already used.');
}
const patches = functions.get(baseFunction) as Set<PatchData<T>> | undefined;
if (!patches) {
throw new Error('Specified function can not be patched');
}
return patches;
};