Browse Source

PR-424 [search] Correct check for undefined variable

The code was comparing the result of `typeof` with a variable named `undefined`. As typeof returns a string it should compare to `'undefined'`.

https://github.com/cloudera/hue/pull/424

What we really want is to check if `callback` is a function, so I changed the nature of the `if` condition.
Mathias Rangel Wulff 9 years ago
parent
commit
8d015845d9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      apps/search/src/search/static/search/js/search.ko.js

+ 1 - 1
apps/search/src/search/static/search/js/search.ko.js

@@ -1470,7 +1470,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
             try {
               data = JSON.bigdataParse(data);
 
-              if (typeof callback != undefined && callback != null) {
+              if (typeof callback === "function") {
                 callback(data);
               }