rename create client, fix client instance test

This commit is contained in:
2016-04-22 16:49:38 -07:00
parent 1171c5f0f1
commit 64945556ff
2 changed files with 11 additions and 5 deletions

View File

@@ -3,7 +3,8 @@ import elasticsearch from 'elasticsearch';
export default function createClient(options) {
let client;
if (options instanceof elasticsearch.Client) {
// if there's a transport property, assume it's a client instance
if (isClient(options)) {
client = options;
} else {
client = new elasticsearch.Client(options);
@@ -11,3 +12,7 @@ export default function createClient(options) {
return client;
};
export function isClient(client) {
return !!client.transport;
}