Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: optimized replaceAll with regexp#15719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: optimize replaceAll with regexp
  • Loading branch information
@Connormiha
Connormiha committedJul 4, 2025
commit295148d49bc645204b94ad1d98a2f2a116e9e0d0
12 changes: 3 additions & 9 deletionspackages/jest-each/src/table/array.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,7 @@ const PRETTY_PLACEHOLDER = '%p';
const INDEX_PLACEHOLDER = '%#';
const NUMBER_PLACEHOLDER = '%$';
const PLACEHOLDER_PREFIX = '%';
const ESCAPED_PLACEHOLDER_PREFIX =/%%/g;
const ESCAPED_PLACEHOLDER_PREFIX ='%%';
const JEST_EACH_PLACEHOLDER_ESCAPE = '@@__JEST_EACH_PLACEHOLDER_ESCAPE__@@';

export default function array(
Expand DownExpand Up@@ -77,17 +77,11 @@ const formatTitle = (
rowIndex,
),
)
.replaceAll(
new RegExp(JEST_EACH_PLACEHOLDER_ESCAPE, 'g'),
PLACEHOLDER_PREFIX,
);
.replaceAll(JEST_EACH_PLACEHOLDER_ESCAPE, PLACEHOLDER_PREFIX);

const normalisePlaceholderValue = (value: unknown) =>
typeof value === 'string'
? value.replaceAll(
new RegExp(PLACEHOLDER_PREFIX, 'g'),
JEST_EACH_PLACEHOLDER_ESCAPE,
)
? value.replaceAll(PLACEHOLDER_PREFIX, JEST_EACH_PLACEHOLDER_ESCAPE)
: value;

const getMatchingPlaceholders = (title: string) =>
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp