Revert knockout model original state back on update cancel?
From a KISS perspective, I would simply load the model again, then you would not need any of this code.

Other than that the code is clean and maintainable, some nitpicking though:


You declare var key twice in copy, that is not required
You are not using hasOwnProperty(key) when you delete all the functions in copy
You could have merged source.hasOwnProperty(key) and key === "__ko_mapping__" with a &amp;&amp;
You access source[key] a lot, you could have considered a var value = source[key] and then work with value