Isolate Netlify, Firebase and Helper functions + Import from absolute paths
This commit is contained in:
7
helpers/templating.js
Normal file
7
helpers/templating.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export default function parseTemplateString(string, variables) {
|
||||
if (!variables || !string) {
|
||||
return string
|
||||
}
|
||||
const searchTerm = /<<([^>]*)>>/g // "<<myVariable>>"
|
||||
return decodeURI(string).replace(searchTerm, (match, p1) => variables[p1] || "")
|
||||
}
|
||||
Reference in New Issue
Block a user