@lingk/sync 1.1.15 → 1.1.16

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.
@@ -3648,7 +3648,7 @@ module.exports =
3648
3648
  f = Math.floor(Math.log(a) / Math.log(c));return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f];
3649
3649
  }
3650
3650
 
3651
- var extensionBlacklist = ['jsonl', 'xml', 'zip', 'tar', 'gz'];
3651
+ var extensionBlacklist = ['xml', 'zip', 'tar', 'gz'];
3652
3652
 
3653
3653
  var FlatFile = function (_Component) {
3654
3654
  _inherits(FlatFile, _Component);
@@ -3697,6 +3697,11 @@ module.exports =
3697
3697
  }
3698
3698
  };
3699
3699
 
3700
+ _this.parseJsonLines = function (content) {
3701
+ var firstLine = content.substring(0, content.indexOf('\n'));
3702
+ return '[' + firstLine + ']';
3703
+ };
3704
+
3700
3705
  _this.parseCSV = function (file, csv) {
3701
3706
  return new Promise(function (resolve, reject) {
3702
3707
  _papaparse2.default.parse(csv || file, {
@@ -3734,7 +3739,6 @@ module.exports =
3734
3739
  var blacklisted = extensionBlacklist.includes(extension);
3735
3740
  if (!blacklisted) {
3736
3741
  (function () {
3737
-
3738
3742
  var isXLS = extension === 'xlsx' || extension === 'xls';
3739
3743
 
3740
3744
  var reader = new FileReader();
@@ -3779,8 +3783,12 @@ module.exports =
3779
3783
  _this.props.onDrop();
3780
3784
  }
3781
3785
  });
3782
- } else if (extension === 'json') {
3783
- var fileMeta = _this.parseJsonFile(data, file);
3786
+ } else if (extension === 'json' || extension === 'jsonl') {
3787
+ var d = data;
3788
+ if (extension === 'jsonl') {
3789
+ d = _this.parseJsonLines(data);
3790
+ }
3791
+ var fileMeta = _this.parseJsonFile(d, file);
3784
3792
  if (fileMeta) {
3785
3793
  meta = meta.concat(fileMeta);
3786
3794
  counter += 1;