Great idea!
Couple of things I would change here:
- Instead of modifying prototype, which would pollute the environment for any other modules to work with - use regular old functions
- Instead of spreading the iterable to an array and then calling `.forEach` on it, I would just iterate the source generator directly, it would look like:
for (const node of xpath(el, 'xpath')) {
node.textContent = node.textContent.replace("Hello", "Greetings")
}