Skip to content

Instantly share code, notes, and snippets.

@raine
Created May 27, 2013 02:30
Show Gist options
  • Select an option

  • Save raine/5654893 to your computer and use it in GitHub Desktop.

Select an option

Save raine/5654893 to your computer and use it in GitHub Desktop.
diff --git a/main.js b/main.js
index 93ed992..2f46a9b 100644
--- a/main.js
+++ b/main.js
@@ -233,7 +233,12 @@ var refreshButton = function(opts) {
}
var getWilting = function(obj) {
- return (obj && (obj.wiltingReduced || obj.wilting)) || 0;
+ if (obj === undefined) { return 0; }
+ if ('wiltingReduced' in obj) {
+ return obj.wiltingReduced;
+ } else if ('wilting' in obj) {
+ return obj.wilting;
+ }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment