"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

var _Object$defineProperty2 = require("@babel/runtime-corejs2/core-js/object/define-property");

_Object$defineProperty2(exports, "__esModule", {
  value: true
});

exports.parseCSV = parseCSV;
exports.toCSV = toCSV;
exports.parseCSVStream = parseCSVStream;
exports.serializeCSVStream = serializeCSVStream;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));

var _defineProperties = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-properties"));

var _getOwnPropertyDescriptors = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors"));

require("core-js/modules/es6.array.for-each");

var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor"));

require("core-js/modules/es6.array.filter");

var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols"));

var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));

var _defineProperty3 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));

var _csvParse = _interopRequireDefault(require("csv-parse"));

var _sync = _interopRequireDefault(require("csv-parse/lib/sync"));

var _csvStringify = _interopRequireDefault(require("csv-stringify"));

var _sync2 = _interopRequireDefault(require("csv-stringify/lib/sync"));

function ownKeys(object, enumerableOnly) { var keys = (0, _keys["default"])(object); if (_getOwnPropertySymbols["default"]) { var symbols = (0, _getOwnPropertySymbols["default"])(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return (0, _getOwnPropertyDescriptor["default"])(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty3["default"])(target, key, source[key]); }); } else if (_getOwnPropertyDescriptors["default"]) { (0, _defineProperties["default"])(target, (0, _getOwnPropertyDescriptors["default"])(source)); } else { ownKeys(Object(source)).forEach(function (key) { (0, _defineProperty2["default"])(target, key, (0, _getOwnPropertyDescriptor["default"])(source, key)); }); } } return target; }

/**
 * @private
 */
function parseCSV(str, options) {
  return (0, _sync["default"])(str, _objectSpread({}, options, {
    columns: true
  }));
}
/**
 * @private
 */


function toCSV(records, options) {
  return (0, _sync2["default"])(records, _objectSpread({}, options, {
    header: true
  }));
}
/**
 * @private
 */


function parseCSVStream(options) {
  return (0, _csvParse["default"])(_objectSpread({}, options, {
    columns: true
  }));
}
/**
 * @private
 */


function serializeCSVStream(options) {
  return (0, _csvStringify["default"])(_objectSpread({}, options, {
    header: true
  }));
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jc3YudHMiXSwibmFtZXMiOlsicGFyc2VDU1YiLCJzdHIiLCJvcHRpb25zIiwiY29sdW1ucyIsInRvQ1NWIiwicmVjb3JkcyIsImhlYWRlciIsInBhcnNlQ1NWU3RyZWFtIiwic2VyaWFsaXplQ1NWU3RyZWFtIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFJQTs7QUFDQTs7QUFDQTs7QUFDQTs7Ozs7O0FBRUE7OztBQUdPLFNBQVNBLFFBQVQsQ0FBa0JDLEdBQWxCLEVBQStCQyxPQUEvQixFQUE2RDtBQUNsRSxTQUFPLHNCQUFhRCxHQUFiLG9CQUF1QkMsT0FBdkI7QUFBZ0NDLElBQUFBLE9BQU8sRUFBRTtBQUF6QyxLQUFQO0FBQ0Q7QUFFRDs7Ozs7QUFHTyxTQUFTQyxLQUFULENBQWVDLE9BQWYsRUFBa0NILE9BQWxDLEVBQW1FO0FBQ3hFLFNBQU8sdUJBQWlCRyxPQUFqQixvQkFBK0JILE9BQS9CO0FBQXdDSSxJQUFBQSxNQUFNLEVBQUU7QUFBaEQsS0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