Skip to content

Instantly share code, notes, and snippets.

@z-------------
Forked from poonl1/gourdify
Last active August 29, 2015 14:12
Show Gist options
  • Save z-------------/992d6e32d474bea318dc to your computer and use it in GitHub Desktop.
Save z-------------/992d6e32d474bea318dc to your computer and use it in GitHub Desktop.
var gourdify = function(map){
var keys = Object.keys(map);
var ps = document.querySelectorAll("p");
[].slice.call(ps).forEach(function(p){
keys.forEach(function(key){
var regex = new RegExp(key + "\\w+", "gi");
p.innerHTML = p.innerHTML.replace(regex, map[key]);
});
});
};
/*
gourdify({
g: "gourd",
h: "harfitt",
e: "eduardo",
y: "yeya",
s: "scrub",
w: "woo",
j: "jaewoo"
});
*/
@Eddy119
Copy link

Eddy119 commented Jan 9, 2015

you forgot
l: "lorry",
v: "vroom",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment