diff --git a/lib/util/template/index.spec.ts b/lib/util/template/index.spec.ts index 9bf157e90756d2e3ba0c91e2627cbb3df495f59e..eceb5229a8745649da52773f8a1a49f1aaf1d6b2 100644 --- a/lib/util/template/index.spec.ts +++ b/lib/util/template/index.spec.ts @@ -253,37 +253,6 @@ describe('util/template/index', () => { }); }); - describe('containsTemplate', () => { - it('supports null', () => { - expect(template.containsTemplates(null, 'logJSON')).toBeFalse(); - }); - - it('contains template', () => { - expect( - template.containsTemplates( - '{{#if logJSON}}{{logJSON}}{{/if}}', - 'logJSON', - ), - ).toBeTrue(); - expect( - template.containsTemplates( - '{{#with logJSON.hasReleaseNotes as | hasNotes |}}{{hasNotes}}{{/if}}', - 'logJSON', - ), - ).toBeTrue(); - expect( - template.containsTemplates( - '{{#if logJSON.hasReleaseNotes}}has notes{{/if}}', - 'logJSON', - ), - ).toBeTrue(); - }); - - it('does not contain template', () => { - expect(template.containsTemplates('{{body}}', ['logJSON'])).toBeFalse(); - }); - }); - describe('percent encoding', () => { it('encodes values', () => { const output = template.compile( diff --git a/lib/util/template/index.ts b/lib/util/template/index.ts index 9a347b9132c510d5edc881ef3a7e1242e093ea6e..b1704195237403ad47983b52565e5ea146d4c85a 100644 --- a/lib/util/template/index.ts +++ b/lib/util/template/index.ts @@ -291,10 +291,6 @@ export function proxyCompileInput( ); } -const templateRegex = regEx( - /{{(?:#(?:if|unless|with|each) )?([a-zA-Z.]+)(?: as \| [a-zA-Z.]+ \|)?}}/g, -); - export function compile( template: string, input: CompileInput, @@ -332,21 +328,3 @@ export function safeCompile( return ''; } } - -export function containsTemplates( - value: unknown, - templates: string | string[], -): boolean { - if (!is.string(value)) { - return false; - } - for (const m of [...value.matchAll(templateRegex)]) { - for (const template of is.string(templates) ? [templates] : templates) { - if (m[1] === template || m[1].startsWith(`${template}.`)) { - return true; - } - } - } - - return false; -}