Skip to content

Conversation

@vbfox
Copy link
Contributor

@vbfox vbfox commented Nov 20, 2025

This behaviour is documented in Lodash examples at https://lodash.com/docs/4.17.15#template :

// Use the ES template literal delimiter as an "interpolate" delimiter.
// Disable support by replacing the "interpolate" delimiter.

And implemented similarly:

https://github.com/lodash/lodash/blob/f299b52f39486275a9e6483b60a410e06520c538/lodash.js#L14864C27-L14864C39

This behaviour is documented in Lodash examples at
https://lodash.com/docs/4.17.15#template :

```
// Use the ES template literal delimiter as an "interpolate" delimiter.
// Disable support by replacing the "interpolate" delimiter.
```
Copilot AI review requested due to automatic review settings November 20, 2025 15:12
@vercel
Copy link

vercel bot commented Nov 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
es-toolkit Ready Ready Preview Comment Nov 26, 2025 1:10pm

Copilot finished reviewing on behalf of vbfox November 20, 2025 15:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the template function to disable ES6 template literal interpolation (${...}) when a custom interpolate delimiter is specified in the options, matching Lodash's documented behavior.

Key changes:

  • Extracted the default interpolate regex pattern into a named constant for reference comparison
  • Modified the delimiter regex construction to enable ES6 template support only when using the default interpolate pattern (by reference equality)
  • Added comprehensive tests to verify ES6 templates are disabled when custom interpolate delimiters are specified

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/compat/string/template.ts Added defaultInterpolateRegExp constant and modified delimiter logic to use reference equality check for enabling ES6 template support
src/compat/string/template.spec.ts Added test cases to verify ES6 template delimiters are properly disabled when custom interpolate patterns are provided

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@dayongkr dayongkr left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution

@dayongkr dayongkr added the p0: major bug bugs in major functions label Nov 26, 2025
@dayongkr dayongkr merged commit eb9e939 into toss:main Nov 26, 2025
7 checks passed
@vbfox vbfox deleted the vbfox/template_disable_es_interpolation branch November 26, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p0: major bug bugs in major functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants