simplified CasopeR.getGlobal()
Showing
1 changed file
with
1 additions
and
2 deletions
... | @@ -871,14 +871,13 @@ Casper.prototype.getGlobal = function getGlobal(name) { | ... | @@ -871,14 +871,13 @@ Casper.prototype.getGlobal = function getGlobal(name) { |
871 | } | 871 | } |
872 | return result; | 872 | return result; |
873 | }, name); | 873 | }, name); |
874 | if (typeof result !== "object") { | 874 | if (!utils.isObject(result)) { |
875 | throw new CasperError(f('Could not retrieve global value for "%s"', name)); | 875 | throw new CasperError(f('Could not retrieve global value for "%s"', name)); |
876 | } else if ('error' in result) { | 876 | } else if ('error' in result) { |
877 | throw new CasperError(result.error); | 877 | throw new CasperError(result.error); |
878 | } else if (utils.isString(result.value)) { | 878 | } else if (utils.isString(result.value)) { |
879 | return JSON.parse(result.value); | 879 | return JSON.parse(result.value); |
880 | } | 880 | } |
881 | return undefined; | ||
882 | }; | 881 | }; |
883 | 882 | ||
884 | /** | 883 | /** | ... | ... |
-
Please register or sign in to post a comment