'use strict';
const _ = require('lodash');
const File = require('vinyl');

let toVinyl = obj => {
  var file = new File();
  var data = _.cloneDeep(obj);

  /**
   * Set the path of the entry to the URL property, if it exists:
   */

  file.path = data.url || '';

  /**
   * Set the data properties:
   */

  file.data = data;
  file.contents = new Buffer(JSON.stringify(data));

  file.stat = {
    size: file.contents.length
  };

  return file;
}

module.exports = toVinyl;

@@ -145,14 +145,29 @@
 eep(
+obj._source %7C%7C 
 obj);%0A
-
 %0A  /
@@ -256,20 +256,19 @@
 .path = 
-data
+obj
 .url %7C%7C 
@@ -439,14 +439,165 @@
 gth%0A
-
   %7D;%0A%0A
+  /**%0A   * If there are any ElasticSearch properties, copy them, too:%0A   */%0A%0A  file.index = obj._index;%0A  file.type = obj._type;%0A  file.id = obj._id;%0A%0A
   re

add minor changes to 'to Vinyl' function to help ElasticSearch updates