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

elasticsearch

Package Overview
Dependencies
Maintainers
1
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elasticsearch - npm Package Compare versions

Comparing version 0.2.3 to 0.2.6

25

lib/elasticsearch.js

@@ -5,13 +5,16 @@ var utils = require('./utils'),

function ElasticSearch(args) {
var opts = args[0] || {},
cb = ((args.length>1)?args[1]:undefined);
if (!(opts.index)) {
throw new Error('Must specify an index for ES.');
} else if (!(opts.index instanceof Index)) {
if (typeof(opts.index) == 'string') {
this.index = new Index({name: opts.index});
} else {
this.index = new Index(opts.index);
}
var opts = args[0] || {};
var cb = ((args.length>1)?args[1]:undefined);
if (!(opts.index)) {
throw new Error('Must specify an index for ES.');
} else if (!(opts.index instanceof Index)) {
if (typeof(opts.index) == 'string') {
this.index = new Index({name: opts.index});
} else {
this.index = new Index(opts.index);
}
};
this.server_config = {

@@ -27,3 +30,3 @@ auth : opts.auth || '',

var self = this;
this.index.create(function(err, res) {
this.index.create(this.server_config, function(err, res) {
if (cb) {

@@ -30,0 +33,0 @@ cb(err, self);

@@ -23,5 +23,2 @@ var http = require('http');

});
if (cb) {
res.on('error', cb);
}
res.on('end', function() {

@@ -59,7 +56,17 @@ var buf = new Buffer(length),

var onError = function(err) {
if (cb) {
cb(err);
}
}
var req;
if (opts.secure) {
req = https.request(opts, callback);
req = https
.request(opts, callback)
.on('error', onError);
} else {
req = http.request(opts, callback);
req = http
.request(opts, callback)
.on('error', onError);
}

@@ -66,0 +73,0 @@

@@ -5,3 +5,3 @@ {

"main": "index.js",
"version": "0.2.3",
"version": "0.2.6",
"author": "Nick Campbell (http://github.com/ncb000gt)",

@@ -8,0 +8,0 @@ "engines": {

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