Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

doofinder

Package Overview
Dependencies
Maintainers
1
Versions
198
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

doofinder - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

prueba.coffee

58

lib/doofinder.js

@@ -69,7 +69,24 @@

Doofinder.prototype.search = function(params, callback) {
var filter_key, filter_terms, headers, options, param_key, param_value, process_response, query_string, req;
Doofinder.prototype.search = function(query, arg1, arg2) {
var callback, filter_key, filter_terms, headers, options, param_key, param_value, params, process_response, query_string, req;
if (arg1 && arg1.constructor === Function) {
callback = arg1;
params = {};
} else if (arg1 && arg2 && arg1.constructor === Object) {
callback = arg2;
params = arg1;
} else {
throw new Error("A callback is required.");
}
if (params.page == null) {
params.page = 1;
}
if (params.rpp == null) {
params.rpp = 10;
}
params.query = query;
headers = {};
this.params = {};
this.filters = {};
this.sort = [];
for (param_key in params) {

@@ -82,2 +99,4 @@ param_value = params[param_key];

}
} else if (param_key === "sort") {
this.set_sort(param_value);
} else {

@@ -122,3 +141,3 @@ if (param_value) {

/*
set_param
add_param

@@ -151,2 +170,16 @@ This method set simple params

/*
set_sort
This method adds sort to object
from an object or an array
@param {Array|Object} sort
*/
Doofinder.prototype.set_sort = function(sort) {
return this.sort = sort;
};
/*
make_querystring

@@ -163,3 +196,3 @@

Doofinder.prototype.make_querystring = function() {
var elem, i, key, len, querystring, ref, ref1, value;
var elem, facet, i, key, len, querystring, ref, ref1, ref2, ref3, term, value;
querystring = "hashid=" + this.hashid;

@@ -185,2 +218,19 @@ ref = this.params;

}
if (this.sort && this.sort.constructor === Array) {
ref2 = this.sort;
for (key in ref2) {
value = ref2[key];
for (facet in value) {
term = value[facet];
querystring += "&sort[" + key + "][" + facet + "]=" + term;
}
}
} else if (this.sort && this.sort.constructor === Object) {
ref3 = this.sort;
for (key in ref3) {
value = ref3[key];
querystring += "&sort[" + key + "]=" + value;
}
}
console.log(encodeURI(querystring));
return encodeURI(querystring);

@@ -187,0 +237,0 @@ };

2

package.json
{
"name": "doofinder",
"version": "0.1.1",
"version": "0.2.0",
"description": "Javascript Client for Doofinder Search API - Beta",

@@ -5,0 +5,0 @@ "main": "lib/doofinder.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc