(#2543) - refactor merge.js