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.2 to 0.8.0

2

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

@@ -5,0 +5,0 @@ "author": {

var isArray = require('./utils/isArray');
var urlutils = require('./utils/url');
/**

@@ -83,9 +83,7 @@ * Query constructor

for (i = 0; i < this.options[k].length; i++) {
var val = "";
if (isArray(this.options[k][i].value)) {
val = this.options[k][i].value.join(';');
} else if (typeof this.options[k][i].value === 'object') {
val = JSON.stringify(this.options[k][i].value);
} else {
val = this.options[k][i].value
var val = this.options[k][i].value;
if (isArray(val)) {
val = val.join(';');
} else if (typeof val === 'object') {
val = JSON.stringify(val);
}

@@ -312,2 +310,21 @@ args[k + '[' + this.options[k][i].key + ']'] = val;

return this;
},
/**
* Add multiple custom attributes via a "data" object
*/
attrs: function(data) {
if (typeof data == 'string') {
data = urlutils.decodeUriArgs(data);
}
if (this.options.attrs === undefined) {
this.options.attrs = [];
}
for (var k in data) {
this.options.attrs.push({
key: k,
value: data[k]
});
}
return this;
}

@@ -314,0 +331,0 @@ };

@@ -78,2 +78,24 @@

var query3 = api.query();
query3.attrs({
disco: 'dancer',
yogi: 'bear'
});
test('Query encoding 3', function (t) {
var enc = query3.encode();
t.equal(enc.disco, "dancer");
t.equal(enc.yogi, "bear");
t.end();
});
var query4 = api.query();
query4.attrs('disco=dancer&yogi=bear');
test('Query encoding 4', function (t) {
var enc = query4.encode();
t.equal(enc.disco, "dancer");
t.equal(enc.yogi, "bear");
t.end();
});
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