Browse Source

Update npm/ng-packs/packages/schematics/src/utils/text.ts

escape single quote

Co-authored-by: Levent Arman Özak <arman@armanozak.com>
pull/6997/head
PM Extra 5 years ago
committed by GitHub
parent
commit
46370ade6f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      npm/ng-packs/packages/schematics/src/utils/text.ts

4
npm/ng-packs/packages/schematics/src/utils/text.ts

@ -10,8 +10,8 @@ export const macro = (text: string) => upper(snake(text));
export const dir = (text: string) =>
strings.dasherize(text.replace(/\./g, '/').replace(/\/\//g, '/'));
// TODO: Is there a standard function to do this? There is a leak if the value contains single quote.
export const quote = (value: number | string) => typeof value === 'string' ? `'${value}'` : value;
export const quote = (value: number | string) =>
typeof value === 'string' ? `'${value.replace(/'/g, `\\'`)}'` : value;
function _(text: string): string {
return text.replace(/\./g, '_');

Loading…
Cancel
Save