refactor(diff) applyPatch