Skip to content

Commit f125cd8

Browse files
josephperrottthePunderWoman
authored andcommitted
fix(docs-infra): replace the uses of replaceAll with replace using regex with g flag (angular#57232)
Use the g flag in replace to perform a replaceAll PR Close angular#57232
1 parent f5960d0 commit f125cd8

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

adev/shared-docs/pipeline/guides/tranformations/heading.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ export const headingRender: RendererApi['heading'] = (text, level, raw) => {
3333
const customIdRegex = /{#\s*([\w-]+)\s*}/g;
3434
const customId = customIdRegex.exec(anchorLessText)?.[1];
3535
const link = customId ?? getHeaderId(anchorLessText);
36-
const label = anchorLessText
37-
.replaceAll(/`(.*?)`/g, '<code>$1</code>')
38-
.replaceAll(customIdRegex, '');
36+
const label = anchorLessText.replace(/`(.*?)`/g, '<code>$1</code>').replace(customIdRegex, '');
3937

4038
return `
4139
<h${level} id="${link}">

adev/src/app/features/references/api-reference-list/api-reference-manager.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class ApiReferenceManager {
6060

6161
groups.push({
6262
title: packageNameWithoutPrefix,
63-
id: packageNameWithoutPrefix.replaceAll('/', '-'),
63+
id: packageNameWithoutPrefix.replace(/\//g, '-'),
6464
items: packageApis
6565
.map((api) => {
6666
const url = getApiUrl(packageNameWithoutPrefix, api.name);

adev/src/app/features/references/helpers/manifest.helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ export function getApiUrl(packageNameWithoutPrefix: string, apiName: string): st
7777

7878
function getNormalizedFilename(moduleName: string, entry: ApiManifestItem): string {
7979
// Angular entry points can contain `/`, we would like to swap `/` with an underscore
80-
const normalizedModuleName = moduleName.replaceAll('/', '_');
80+
const normalizedModuleName = moduleName.replace(/\//g, '_');
8181
return `angular_${normalizedModuleName}_${entry.name}_${entry.type}.html`;
8282
}

0 commit comments

Comments
 (0)