From d0abad344a7d128ad12b05bba90f5ca2eac1e7c9 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Thu, 14 Apr 2016 17:00:50 -0700 Subject: [PATCH] add default setting values --- package.json | 3 ++- src/index.js | 11 +++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index cf16c21..2c5247c 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "sinon": "~1.17.3" }, "dependencies": { - "elasticsearch": "~11.0.1" + "elasticsearch": "~11.0.1", + "lodash": "~4.11.1" } } diff --git a/src/index.js b/src/index.js index cd04c0b..d1a3b7e 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,6 @@ import events from 'events'; import createClient from './helpers/create_client'; +import { omit } from 'lodash'; export default class Elastique extends events.EventEmitter { constructor(options = {}) { @@ -7,12 +8,10 @@ export default class Elastique extends events.EventEmitter { super(); this.ready = true; - - this.settings = {}; - Object.keys(options, (key) => { - if (key !== 'client') this.settings[key] = options[key]; - }); - + this.settings = Object.assign({ + interval: '1w', + timeout: 10000, + }, omit(options, [ 'client' ])); this.client = createClient(options.client); }