Files
operator/src/utils/naming.ts
Morten Olsen 757b2fcfac lot more stuff
2025-08-04 23:44:14 +02:00

14 lines
364 B
TypeScript

const getWithNamespace = (input: string, defaultNamespace?: string) => {
const result = input.split('/');
const first = result.pop();
if (!first) {
throw new Error(`${input} could not be parsed as a namespace`);
}
return {
name: first,
namespace: result.length > 0 ? result.join('/') : defaultNamespace,
};
};
export { getWithNamespace };