code: function csvwriter(data, params, callback) {
      if (typeof params === 'function') {
          callback = params;
          params = undefined;
      }
  
      params = applyDefaults(params);
  
      if (typeof data !== 'object' && !(data instanceof Array)) {
          try {
              data = JSON.parse(data);
          } catch (err) {
              callback(err);
              return;
          }
      }
  
      if (params.path) {
          try {
              data = jsonpath({path:params.path, json:data});
          } catch (err) {
              callback(err);
              return;
          }
      }
  
      if (!(data instanceof Array)) {
          data = [data];
      }
  
      var columns = [];
      var rows = [];
  
      data.forEach(function (d) {
          rows.push(flatten(d, columns, params));
      });
  
      columns = params.fields ? params.fields.split(',') : columns;
  
      callback(null, params.table ?
          createCLITable(rows, columns, params) :
          createCSV(rows, columns, params));
  }
docs: @callback csvCallback
  @param {error} err - Error object or null if no error occurred.
  @param {string} csv - The generated CSV as string.
   
  Convert any JSON string to CSV with support for nested objects, filtering, many different CSV variations, CLI, ...
  
  @param {(string|object)} data - The source json data which should be converted. Can be a string or a javascript object.
  @param {csvParameters} [params] - Configuration of the CSV generation.
  @param {csvCallback} callback - Callback to handle the generated CSV string.