Created
December 22, 2014 20:47
-
-
Save marclundgren/7db4a6b6984c9fdfe198 to your computer and use it in GitHub Desktop.
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
// Sub utility | |
var sub = function(str, obj) { | |
var keys = Object.keys(obj); | |
keys.map(function(key) { | |
var re = new RegExp('{' + key + '}', 'gm'); | |
str = str.replace(re, obj[key]); | |
}); | |
return str; | |
}; | |
module.exports = sub; |
Author
marclundgren
commented
Dec 22, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment