doofinder
Advanced tools
Comparing version 1.0.7 to 1.0.8
{ | ||
"name": "doofinder", | ||
"description": "Javascript Library for Doofinder Search API", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"main": "dist/doofinder.js", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -76,3 +76,6 @@ | ||
maxQueryLength = 255; | ||
if (query === null || !query.constructor === String) { | ||
if (typeof query === "undefined") { | ||
throw Error("Query must be a defined"); | ||
} | ||
if (query === null || query.constructor !== String) { | ||
throw Error("Query must be a String"); | ||
@@ -135,5 +138,5 @@ } | ||
_this = this; | ||
return this._sanitizeQuery(query, function(res) { | ||
var filterKey, filterTerms, headers, options, paramKey, paramValue, processResponse, queryString, req; | ||
params.query = res; | ||
return this._sanitizeQuery(query, function(cleaned) { | ||
var filterKey, filterTerms, headers, options, paramKey, paramValue, queryString, req; | ||
params.query = cleaned; | ||
headers = {}; | ||
@@ -169,19 +172,2 @@ if (_this.apiKey) { | ||
} | ||
processResponse = function(res) { | ||
var data; | ||
if (res.statusCode >= 400) { | ||
return callback(res.statusCode, null); | ||
} else { | ||
data = ""; | ||
res.on('data', function(chunk) { | ||
return data += chunk; | ||
}); | ||
res.on('end', function() { | ||
return callback(null, JSON.parse(data)); | ||
}); | ||
return res.on('error', function(err) { | ||
return callback(err, null); | ||
}); | ||
} | ||
}; | ||
req = httpLib.request(options, _this.__processResponse(callback)); | ||
@@ -188,0 +174,0 @@ return req.end(); |
@@ -192,7 +192,9 @@ | ||
Controller.prototype.refresh = function() { | ||
this.trigger("df:refresh", [this.status.params]); | ||
this.status.currentPage = 1; | ||
this.status.firstQueryTriggered = true; | ||
this.status.lastPageReached = false; | ||
return this.__search(); | ||
if (this.status.params.query) { | ||
this.trigger("df:refresh", [this.status.params]); | ||
this.status.currentPage = 1; | ||
this.status.firstQueryTriggered = true; | ||
this.status.lastPageReached = false; | ||
return this.__search(); | ||
} | ||
}; | ||
@@ -199,0 +201,0 @@ |
(function() { | ||
module.exports = { | ||
version: "1.0.7", | ||
version: "1.0.8", | ||
Client: require("./client"), | ||
@@ -5,0 +5,0 @@ Handlebars: require("handlebars"), |
{ | ||
"name": "doofinder", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Javascript Library for Doofinder Search API", | ||
@@ -5,0 +5,0 @@ "main": "lib/doofinder.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87840
1913