handlebars-lang / handlebars-lang/handlebars.js
How to call String.prototype.trim (or any other prototype function) as shown in the documentation example?
- Dominant language
- JavaScript
- Stars
- 18.7k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
Before filing issues, please check the following points first:
- [x] Please don't open issues for security issues. Instead, file a report at https://www.npmjs.com/advisories/report?package=handlebars
- [x] Have a look at https://github.com/wycats/handlebars.js/blob/master/CONTRIBUTING.md
- [x] Read the FAQ at https://github.com/wycats/handlebars.js/blob/master/FAQ.md
- [x] Use the jsfiddle-template at https://jsfiddle.net/4nbwjaqz/4/ to reproduce problems or bugs
This will probably help you to get a solution faster.
For bugs, it would be great to have a PR with a failing test-case.
I have been trying the example from the docs calling `String.prototype.trim` to work, but it does not seem to return the desired result (https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access).
https://jsfiddle.net/3yahoj1d/
Can anyone explain why the result prints as `[object Object]` to the console when `typeof result` returns `string`, or how to get the example to work?
I have also asked this on StackOverflow (https://stackoverflow.com/q/67416982/5115898) so feel free to close this issue if this is not a problem with handlebars itself.
Contributor guide
Assessment
This issue has not been assessed yet.