@cosmotech/core 1.10.1 → 1.10.3-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -60,6 +60,7 @@ function _asyncToGenerator(fn) {
60
60
  };
61
61
  }
62
62
  function _defineProperty$w(obj, key, value) {
63
+ key = _toPropertyKey(key);
63
64
  if (key in obj) {
64
65
  Object.defineProperty(obj, key, {
65
66
  value: value,
@@ -72,6 +73,20 @@ function _defineProperty$w(obj, key, value) {
72
73
  }
73
74
  return obj;
74
75
  }
76
+ function _toPrimitive(input, hint) {
77
+ if (typeof input !== "object" || input === null) return input;
78
+ var prim = input[Symbol.toPrimitive];
79
+ if (prim !== undefined) {
80
+ var res = prim.call(input, hint || "default");
81
+ if (typeof res !== "object") return res;
82
+ throw new TypeError("@@toPrimitive must return a primitive value.");
83
+ }
84
+ return (hint === "string" ? String : Number)(input);
85
+ }
86
+ function _toPropertyKey(arg) {
87
+ var key = _toPrimitive(arg, "string");
88
+ return typeof key === "symbol" ? key : String(key);
89
+ }
75
90
 
76
91
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
77
92
 
@@ -592,8 +607,8 @@ var read$1 = dataStr => {
592
607
  return row.map(cell => cell.trim());
593
608
  });
594
609
  };
595
- var write = dataArray => {
596
- return dist.stringify(dataArray);
610
+ var write = (dataArray, separator) => {
611
+ return dist.stringify(dataArray, separator);
597
612
  };
598
613
  var CSVUtils = {
599
614
  read: read$1,
@@ -33850,7 +33865,8 @@ var _generateHeader = function _generateHeader(cols) {
33850
33865
  };
33851
33866
  var _generateRow = function _generateRow(row, cols) {
33852
33867
  var separator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ',';
33853
- return cols.map(col => row[col.field]).join(separator);
33868
+ // CSV.write(...) adds a newline at the end of the string, hence the "slice(0, -2)"
33869
+ return CSVUtils.write([cols.map(col => row[col.field])], separator).slice(0, -2);
33854
33870
  };
33855
33871
  var _generateRows = function _generateRows(rows, cols) {
33856
33872
  var colSep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ',';
package/dist/index.esm.js CHANGED
@@ -52,6 +52,7 @@ function _asyncToGenerator(fn) {
52
52
  };
53
53
  }
54
54
  function _defineProperty$w(obj, key, value) {
55
+ key = _toPropertyKey(key);
55
56
  if (key in obj) {
56
57
  Object.defineProperty(obj, key, {
57
58
  value: value,
@@ -64,6 +65,20 @@ function _defineProperty$w(obj, key, value) {
64
65
  }
65
66
  return obj;
66
67
  }
68
+ function _toPrimitive(input, hint) {
69
+ if (typeof input !== "object" || input === null) return input;
70
+ var prim = input[Symbol.toPrimitive];
71
+ if (prim !== undefined) {
72
+ var res = prim.call(input, hint || "default");
73
+ if (typeof res !== "object") return res;
74
+ throw new TypeError("@@toPrimitive must return a primitive value.");
75
+ }
76
+ return (hint === "string" ? String : Number)(input);
77
+ }
78
+ function _toPropertyKey(arg) {
79
+ var key = _toPrimitive(arg, "string");
80
+ return typeof key === "symbol" ? key : String(key);
81
+ }
67
82
 
68
83
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
69
84
 
@@ -584,8 +599,8 @@ var read$1 = dataStr => {
584
599
  return row.map(cell => cell.trim());
585
600
  });
586
601
  };
587
- var write = dataArray => {
588
- return dist.stringify(dataArray);
602
+ var write = (dataArray, separator) => {
603
+ return dist.stringify(dataArray, separator);
589
604
  };
590
605
  var CSVUtils = {
591
606
  read: read$1,
@@ -33842,7 +33857,8 @@ var _generateHeader = function _generateHeader(cols) {
33842
33857
  };
33843
33858
  var _generateRow = function _generateRow(row, cols) {
33844
33859
  var separator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ',';
33845
- return cols.map(col => row[col.field]).join(separator);
33860
+ // CSV.write(...) adds a newline at the end of the string, hence the "slice(0, -2)"
33861
+ return CSVUtils.write([cols.map(col => row[col.field])], separator).slice(0, -2);
33846
33862
  };
33847
33863
  var _generateRows = function _generateRows(rows, cols) {
33848
33864
  var colSep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ',';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cosmotech/core",
3
3
  "private": false,
4
- "version": "1.10.1",
4
+ "version": "1.10.3-dev.0",
5
5
  "description": "",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.esm.js",