Skip to content

Fix unnamed placeholders extraction#25

Merged
aduth merged 2 commits into
aduth:masterfrom
sdnunca:fix/sprintf-types-placeholder-count
Aug 30, 2025
Merged

Fix unnamed placeholders extraction#25
aduth merged 2 commits into
aduth:masterfrom
sdnunca:fix/sprintf-types-placeholder-count

Conversation

@sdnunca

@sdnunca sdnunca commented Aug 26, 2025

Copy link
Copy Markdown
Contributor

The unnamed placeholder logic skips positional placeholders, which it determines as:
% followed by anything followed by $.

This causes strings such as:

Test %s with $ after

to be interpreted as having a %s with $ positional placeholder, returning [].

This PR makes the logic to determine positional placeholders more specific:
% followed by a number followed by $.

@aduth

aduth commented Aug 28, 2025

Copy link
Copy Markdown
Owner

Thanks for the patch! This change makes sense to me, though I'd be curious for @USERSATOSHI's feedback as well, since he authored the typings.

@USERSATOSHI

Copy link
Copy Markdown
Contributor

Oh, nice catch. I have tested the patch and it works great. So Looks good to me.

cc: @sdnunca @aduth

@aduth aduth left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @USERSATOSHI for the review, and thanks again @sdnunca for the fix. I'll get this published shortly.

@aduth aduth merged commit 69d36e3 into aduth:master Aug 30, 2025
3 checks passed
@aduth

aduth commented Aug 30, 2025

Copy link
Copy Markdown
Owner

This is now published in @tannin/sprintf@1.3.3 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants