Skip to content

Allow to pass raw value to the custom interpolation escape function #1076

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2018

Conversation

eugef
Copy link
Contributor

@eugef eugef commented Jul 20, 2018

If custom escape function is used, then raw value (not type casted to String) can be passed to it.

This PR solves issue #1058

New Interpolation options is added:

option default description
useRawValueToEscape false If true, then value passed into escape function is not casted to string, use with custom escape function that does its own type check)

My example use-case: Handlebars.Utils.escapeExpression is used as escape function and useRawValueToEscape is true then escaping can be disabled for a specific value as soon as it is wrapped in Handlebars.SafeString.

If custom escape function is used, then raw value (not type casted to String) can be passed to it.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 85.766% when pulling fae0fb8 on eugef:master into 0670129 on i18next:master.

@jamuhl
Copy link
Member

jamuhl commented Jul 20, 2018

will check and merge this later today / tomorrow

@jamuhl jamuhl merged commit 680b2d9 into i18next:master Jul 21, 2018
@jamuhl
Copy link
Member

jamuhl commented Jul 21, 2018

published in i18next@11.4.0

thank you for setting this PR up

@eugef
Copy link
Contributor Author

eugef commented Jul 23, 2018

Thank you for quick release!

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