fix to an infinite loop when the same word is in the search and replace
modified that it can be used as a library (separate main.js)
fixed to error when mapping.source is undefined.
Merge pull request #1 from arielnetworks/master

fix to an infinite loop when the same word is in --search and --replace