Created
August 30, 2016 19:25
-
-
Save TheBox193/a0daa634e31c2076a795991525c21f7e to your computer and use it in GitHub Desktop.
A functional style curried LoDash template function, taking in config first, then string, then values. With sample using mustache template.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
templateString = _.curry( | |
(config, string, valueObj) => _.template(string, config )(valueObj) | |
) | |
templateMustache = templateString({interpolate: /{{([\s\S]+?)}}/g}); | |
TempString = templateMustache('hello {{user}}!', { user: 'mustache' }) | |
console.log(TempString) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment