feat: add parseNamespace utility fn to schematics

pull/5137/head
Arman Ozak 5 years ago
parent 325c02dfe2
commit 3cc935918d

@ -1,6 +1,7 @@
export * from './angular';
export * from './ast';
export * from './common';
export * from './namespace';
export * from './rule';
export * from './source';
export * from './text';

@ -0,0 +1,15 @@
export function parseNamespace(solution: string, type: string) {
let namespace = type
.split('.')
.slice(0, -1)
.join('.');
solution.split('.').reduceRight((acc, part) => {
acc = part + '.' + acc;
const regex = new RegExp('^' + acc + '(Controllers.)?');
namespace = namespace.replace(regex, '');
return acc;
}, '');
return namespace;
}
Loading…
Cancel
Save