@redpc/core
Version:
Remoted Procedure Call (RedPC) - A javascript RPC library written with TypeScript
17 lines (14 loc) • 361 B
text/typescript
const ConventionalSuffixesToRemove = [
/server$/i,
/client$/i,
/proxy$/i,
/stub$/i,
];
export function scrapeConventionalSuffixes(name: string): string {
for (const pattern of ConventionalSuffixesToRemove) {
if (pattern.test(name)) {
return name.replace(pattern, '');
}
}
return name;
}