diff & merge algorithm realized with Javascript