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

sajari

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sajari - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

9

gulpfile.js

@@ -6,2 +6,3 @@ var gulp = require('gulp');

var jshint = require('gulp-jshint');
var jslint = require('gulp-jslint');
var tape = require('gulp-tape');

@@ -23,2 +24,8 @@ var tapColorize = require('tap-colorize');

gulp.task('lint', function() {
gulp.src('./src/js/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
});
gulp.task('test', function() {

@@ -54,3 +61,3 @@ return gulp.src('tests/*.js')

gulp.task('default', ['test', 'browserify', 'uglify']);
gulp.task('default', ['lint', 'test', 'browserify', 'uglify']);

@@ -57,0 +64,0 @@ gulp.task("watch", ['beautify'], function() {

4

package.json
{
"name": "sajari",
"version": "0.7.0",
"version": "0.7.1",
"description": "JavaScript SDK for access to the Sajari search API",

@@ -37,2 +37,3 @@ "author": {

"gulp-jshint": "^2.0.0",
"gulp-jslint": "^0.2.2",
"gulp-shell": "^0.5.1",

@@ -43,2 +44,3 @@ "gulp-tape": "0.0.7",

"jshint": "^2.8.0",
"jshint-stylish": "^2.1.0",
"tap-colorize": "^1.2.0",

@@ -45,0 +47,0 @@ "tape": "^4.4.0",

@@ -25,7 +25,7 @@ /*

log.error('Please provide a company ID. ' + usage);
return
return;
}
if (!collection) {
log.error('Please provide a collection ID. ' + usage);
return
return;
}

@@ -35,3 +35,5 @@ this.company = company;

opts = opts || {};
if (opts === undefined) {
opts = {};
}
for (var o in opts) {

@@ -50,3 +52,3 @@ this[o] = opts[o];

index: "https://re.sajari.com"
}
};

@@ -61,7 +63,7 @@ log.info('API init done, %j', this);

search: function(data, success, failure) {
opts = {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("search", opts, data);

@@ -74,7 +76,7 @@ },

popular: function(data, success, failure) {
opts = {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("popular", opts, data);

@@ -87,7 +89,7 @@ },

related: function(data, success, failure) {
opts = {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("related", opts, data);

@@ -100,7 +102,7 @@ },

recent: function(data, success, failure) {
opts = {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("recent", opts, data);

@@ -113,7 +115,7 @@ },

best: function(data, success, failure) {
opts = {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("best", opts, data);

@@ -148,3 +150,3 @@ },

if (path === undefined) {
return
return;
}

@@ -169,3 +171,3 @@ img.src = url.augmentUri(this.hosts.index + path, data);

}
return secondary
return secondary;
},

@@ -178,7 +180,7 @@

fingerprint: function(data, success, failure) {
opts = {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("fingerprint", opts, data);

@@ -191,9 +193,9 @@ },

fingerprintReset: function(fingerprint, success, failure) {
opts = {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
if (typeof data !== 'string') {
log.error("Fingerprint should be a string")
log.error("Fingerprint should be a string");
}

@@ -212,10 +214,10 @@ var data = {

*/
fingerprintWeight: function(fingerprint, docId, pos, neg) {
opts = {
fingerprintWeight: function(fingerprint, docId, pos, neg, success, failure) {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
if (typeof data !== 'string') {
log.error("Fingerprint should be a string")
log.error("Fingerprint should be a string");
}

@@ -231,8 +233,8 @@ var data = {

*/
add: function(query) {
opts = {
add: function(query, success, failure) {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("add", opts, data);

@@ -244,11 +246,11 @@ },

*/
getById: function(docId) {
getById: function(docId, success, failure) {
if (typeof docId !== 'string') {
log.error("docId should be a string. If using a unique meta key, use the get(data) function instead.");
}
opts = {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("get/" + docId, opts, null);

@@ -262,8 +264,8 @@ },

*/
get: function(data) {
opts = {
get: function(data, success, failure) {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("get", opts, data);

@@ -279,11 +281,11 @@ },

*/
put: function(docId, data) {
put: function(docId, data, success, failure) {
if (typeof docId !== 'string') {
log.error("docId should be a string.");
}
opts = {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("put/" + docId, opts, data);

@@ -297,11 +299,11 @@ },

*/
patchById: function(docId, data) {
patchById: function(docId, data, success, failure) {
if (typeof docId !== 'string') {
log.error("docId should be a string. If using a unique meta key, use the patch(data) function instead.");
}
opts = {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("patch/" + docId, opts, null);

@@ -316,8 +318,8 @@ },

*/
patch: function(data) {
opts = {
patch: function(data, success, failure) {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("patch", opts, data);

@@ -329,11 +331,11 @@ },

*/
removeById: function(docId) {
removeById: function(docId, success, failure) {
if (typeof docId !== 'string') {
log.error("docId should be a string. If using a unique meta key, use the remove(data) function instead.");
}
opts = {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("remove/" + docId, opts, null);

@@ -347,8 +349,8 @@ },

*/
remove: function(data) {
opts = {
remove: function(data, success, failure) {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("remove", opts, data);

@@ -362,11 +364,11 @@ },

*/
replaceById: function(docId, data) {
replaceById: function(docId, data, success, failure) {
if (typeof docId !== 'string') {
log.error("docId should be a string. If using a unique meta key, use the patch(data) function instead.");
}
opts = {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("replace/" + docId, opts, null);

@@ -381,8 +383,8 @@ },

*/
replace: function(data) {
opts = {
replace: function(data, success, failure) {
var opts = {
method: "POST",
success: success,
failure: failure,
}
};
return this.send("replace", opts, data);

@@ -406,3 +408,3 @@ },

var path = this.hosts.api + path;
path = this.hosts.api + path;
if (this.jsonp) {

@@ -412,17 +414,18 @@ // Add the data to the JSONP URL destination

}
var req;
switch (opts.method) {
case "POST":
var req = request.post(path);
req = request.post(path);
break;
case "GET":
var req = request.get(path);
req = request.get(path);
break;
case "PATCH":
var req = request.patch(path);
req = request.patch(path);
break;
case "DELETE":
var req = request.del(path);
req = request.del(path);
break;
case "PUT":
var req = request.put(path);
req = request.put(path);
break;

@@ -453,3 +456,3 @@ default:

}
})
});
}

@@ -465,3 +468,3 @@ };

data = data.encode();
return data
return data;
}

@@ -475,5 +478,5 @@ if (typeof data === 'string') {

}
return data
return data;
}
module.exports = API;

@@ -52,3 +52,3 @@ var isArray = require('./utils/isArray');

if (this.options.cols !== undefined) {
args['cols'] = this.options.cols.join(',');
args.cols = this.options.cols.join(',');
}

@@ -59,7 +59,7 @@

var filterArgs = [];
for (var i = 0; i < this.options.filters.length; i++) {
for (i = 0; i < this.options.filters.length; i++) {
filterArgs.push(queryFilterArg(this.options.filters[i]));
}
if (filterArgs.length > 0) {
args['filters'] = filterArgs.join('|');
args.filters = filterArgs.join('|');
}

@@ -71,7 +71,7 @@ }

var scaleArgs = [];
for (var i = 0; i < this.options.scales.length; i++) {
for (i = 0; i < this.options.scales.length; i++) {
scaleArgs.push(queryScaleArg(this.options.scales[i]));
}
if (scaleArgs.length > 0) {
args['scales'] = scaleArgs.join('|');
args.scales = scaleArgs.join('|');
}

@@ -85,3 +85,3 @@ }

if (this.options[k] !== undefined) {
for (var i = 0; i < this.options[k].length; i++) {
for (i = 0; i < this.options[k].length; i++) {
if (isArray(this.options[k][i].value)) {

@@ -104,3 +104,3 @@ args[k + '[' + this.options[k][i].key + ']'] = this.options[k][i].value.join(';');

if (this.options.attrs !== undefined) {
for (var i = 0; i < this.options.attrs.length; i++) {
for (i = 0; i < this.options.attrs.length; i++) {
args[this.options.attrs[i].key] = this.options.attrs[i].value;

@@ -313,3 +313,3 @@ }

}
}
};

@@ -316,0 +316,0 @@ /**

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