I appreciate the use of `hasOwnProperty` but I think it's overkill in here and makes the code longer and harder to read.  Just check for the property in each case, unless you know you need to do this.