melanke / Watch.JS

watch the changes of any object or attribute
Other
2.14k stars 219 forks source link

Making unwatchOne more secure #86

Closed superguigui closed 9 years ago

superguigui commented 9 years ago

In the unwatchOne function, test if a watcher exist for a given prop on obj. The test was previously only applied in the case no watcher parameter was given but it is also necessary when iterating over object watchers. This commit prevents unwatchOne to throw an error when it's called by the unwatchAll method (this error might only happen when dealing with nested objects).