Browse Source

add util fn to check if string is valid prop name

pull/8015/head
Arman Ozak 6 years ago
parent
commit
ab9ee98e28
  1. 1
      npm/ng-packs/packages/schematics/src/utils/index.ts
  2. 9
      npm/ng-packs/packages/schematics/src/utils/prop.ts

1
npm/ng-packs/packages/schematics/src/utils/index.ts

@ -10,6 +10,7 @@ export * from './import';
export * from './model';
export * from './namespace';
export * from './path';
export * from './prop';
export * from './rule';
export * from './service';
export * from './source';

9
npm/ng-packs/packages/schematics/src/utils/prop.ts

@ -0,0 +1,9 @@
export const isValidProp = (name: string) => {
try {
new Function(name, 'var ' + name);
} catch (_) {
return false;
}
return true;
};
Loading…
Cancel
Save