mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
docs: add encodeURIComponent
, replace
handlebars helpers (#12672)
This commit is contained in:
parent
1d2c9d8e70
commit
cc016ac14c
1 changed files with 21 additions and 0 deletions
|
@ -37,6 +37,27 @@ If you want to print pretty JSON with Handlebars you can use the built-in functi
|
||||||
|
|
||||||
In the example above `myvar` is a variable/field, that contains valid JSON.
|
In the example above `myvar` is a variable/field, that contains valid JSON.
|
||||||
|
|
||||||
|
### encodeURIComponent
|
||||||
|
|
||||||
|
If you want to convert a string to a valid URI, use the built-in function `encodeURIComponent` like this:
|
||||||
|
|
||||||
|
`{{{encodeURIComponent baseDir}}}`
|
||||||
|
|
||||||
|
In the example above `baseDir` is the string you want to transform into a valid URI.
|
||||||
|
|
||||||
|
Read the [MDN Web Docs, encodeURIComponent()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) to learn more.
|
||||||
|
|
||||||
|
### replace
|
||||||
|
|
||||||
|
The `replace` helper replaces _all_ found strings with the replacement string.
|
||||||
|
If you want to replace some characters in a string, use the built-in function `replace` like this:
|
||||||
|
|
||||||
|
`{{{replace 'github.com', 'ghc', depName}}}`
|
||||||
|
|
||||||
|
In the example above all matches of `github.com` will be replaced by `ghc` in `depName`.
|
||||||
|
|
||||||
|
Read the [MDN Web Docs, String.prototype.replace()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) to learn more.
|
||||||
|
|
||||||
### containsString
|
### containsString
|
||||||
|
|
||||||
Returns `true` if a given string is a substring.
|
Returns `true` if a given string is a substring.
|
||||||
|
|
Loading…
Reference in a new issue