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

esq

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esq - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

109

lib/esq.js

@@ -1,56 +0,77 @@

function ESQ() {
this._query = { };
}
module.exports = ESQ;
(function() {
var root = this;
var previous_ESQ = root.ESQ;
ESQ.prototype.getQuery = function() {
return this._query;
};
var ESQ = function() {
this._query = { };
};
ESQ.prototype.query = function() {
var args = this._getArgsAsArray(arguments);
var value = args.pop();
ESQ.prototype.getQuery = function() {
return this._query;
};
this._createNestedObject(this._query, args, value);
return this._query;
};
ESQ.prototype.query = function() {
var args = this._getArgsAsArray(arguments);
var value = args.pop();
ESQ.prototype._createNestedObject = function(base, names, value) {
var lastName = arguments.length === 3 ? names.pop() : false;
this._createNestedObject(this._query, args, value);
return this._query;
};
for (var i=0; i<names.length; i++) {
base = base[names[i]] = base[names[i]] || { };
}
ESQ.prototype._createNestedObject = function(base, names, value) {
var lastName = arguments.length === 3 ? names.pop() : false;
if (lastName) {
if (lastName instanceof Array) value = [value];
for (var i=0; i<names.length; i++) {
base = base[names[i]] = base[names[i]] || { };
}
if (value instanceof Array) {
base[lastName] = base[lastName] ? base[lastName].concat(value) : value;
} else if (value instanceof Object) {
base[lastName] ? this._extend(base[lastName], value) : base[lastName] = value;
if (lastName) {
if (lastName instanceof Array) value = [value];
if (value instanceof Array) {
base[lastName] = base[lastName] ? base[lastName].concat(value) : value;
} else if (value instanceof Object) {
base[lastName] ? this._extend(base[lastName], value) : base[lastName] = value;
}
base = base[lastName] = base[lastName] || value || { };
}
base = base[lastName] = base[lastName] || value || { };
}
if ((names.length == 0) && !lastName && value) {
base = value;
}
};
if ((names.length == 0) && !lastName && value) {
base = value;
}
};
ESQ.prototype._getArgsAsArray = function(args) {
if (args && (args instanceof Array)) return args;
return Array.prototype.slice.call(args);
};
ESQ.prototype._getArgsAsArray = function(args) {
if (args && (args instanceof Array)) return args;
return Array.prototype.slice.call(args);
};
ESQ.prototype._extend = function(obj) {
var args = Array.prototype.slice.call(arguments, 1);
args.forEach(function(source) {
if (source) {
for (var prop in source) {
obj[prop] = source[prop];
ESQ.prototype._extend = function(obj) {
var args = Array.prototype.slice.call(arguments, 1);
args.forEach(function(source) {
if (source) {
for (var prop in source) {
obj[prop] = source[prop];
}
}
}
});
return obj;
};
});
return obj;
};
ESQ.noConflict = function() {
root.ESQ = previous_ESQ;
return ESQ;
};
if (typeof define !== 'undefined' && define.amd) { //require.js
define([], function () {
return ESQ;
});
} else if (typeof module !== 'undefined' && module.exports) { //nodejs
module.exports = ESQ;
} else { //direct browser require
root.ESQ = ESQ;
}
}).call(this);
{
"name": "esq",
"version": "0.0.5",
"version": "0.0.6",
"description": "Easily build elasticsearch queries",

@@ -18,3 +18,3 @@ "keywords": [

"type": "git",
"url": "git@github.com:holidayextras/esq.git"
"url": "http://github.com/holidayextras/esq"
},

@@ -21,0 +21,0 @@ "scripts": {

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