22
33function _wrapNativeSuper ( Class ) { var _cache = typeof Map === "function" ? new Map ( ) : undefined ; _wrapNativeSuper = function _wrapNativeSuper ( Class ) { if ( Class === null || ! _isNativeFunction ( Class ) ) return Class ; if ( typeof Class !== "function" ) { throw new TypeError ( "Super expression must either be null or a function" ) ; } if ( typeof _cache !== "undefined" ) { if ( _cache . has ( Class ) ) return _cache . get ( Class ) ; _cache . set ( Class , Wrapper ) ; } function Wrapper ( ) { return _construct ( Class , arguments , _getPrototypeOf ( this ) . constructor ) ; } Wrapper . prototype = Object . create ( Class . prototype , { constructor : { value : Wrapper , enumerable : false , writable : true , configurable : true } } ) ; return _setPrototypeOf ( Wrapper , Class ) ; } ; return _wrapNativeSuper ( Class ) ; }
44
5- function isNativeReflectConstruct ( ) { if ( typeof Reflect === "undefined" || ! Reflect . construct ) return false ; if ( Reflect . construct . sham ) return false ; if ( typeof Proxy === "function" ) return true ; try { Date . prototype . toString . call ( Reflect . construct ( Date , [ ] , function ( ) { } ) ) ; return true ; } catch ( e ) { return false ; } }
6-
7- function _construct ( Parent , args , Class ) { if ( isNativeReflectConstruct ( ) ) { _construct = Reflect . construct ; } else { _construct = function _construct ( Parent , args , Class ) { var a = [ null ] ; a . push . apply ( a , args ) ; var Constructor = Function . bind . apply ( Parent , a ) ; var instance = new Constructor ( ) ; if ( Class ) _setPrototypeOf ( instance , Class . prototype ) ; return instance ; } ; } return _construct . apply ( null , arguments ) ; }
5+ function _construct ( Parent , args , Class ) { if ( _isNativeReflectConstruct ( ) ) { _construct = Reflect . construct ; } else { _construct = function _construct ( Parent , args , Class ) { var a = [ null ] ; a . push . apply ( a , args ) ; var Constructor = Function . bind . apply ( Parent , a ) ; var instance = new Constructor ( ) ; if ( Class ) _setPrototypeOf ( instance , Class . prototype ) ; return instance ; } ; } return _construct . apply ( null , arguments ) ; }
86
97function _isNativeFunction ( fn ) { return Function . toString . call ( fn ) . indexOf ( "[native code]" ) !== - 1 ; }
108
119function _typeof ( obj ) { "@babel/helpers - typeof" ; if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function _typeof ( obj ) { return typeof obj ; } ; } else { _typeof = function _typeof ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
1210
13- function _slicedToArray ( arr , i ) { return _arrayWithHoles ( arr ) || _iterableToArrayLimit ( arr , i ) || _nonIterableRest ( ) ; }
11+ function _slicedToArray ( arr , i ) { return _arrayWithHoles ( arr ) || _iterableToArrayLimit ( arr , i ) || _unsupportedIterableToArray ( arr , i ) || _nonIterableRest ( ) ; }
1412
15- function _nonIterableRest ( ) { throw new TypeError ( "Invalid attempt to destructure non-iterable instance" ) ; }
13+ function _nonIterableRest ( ) { throw new TypeError ( "Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method. " ) ; }
1614
17- function _iterableToArrayLimit ( arr , i ) { if ( ! ( Symbol . iterator in Object ( arr ) || Object . prototype . toString . call ( arr ) === "[object Arguments]" ) ) { return ; } var _arr = [ ] ; var _n = true ; var _d = false ; var _e = undefined ; try { for ( var _i = arr [ Symbol . iterator ] ( ) , _s ; ! ( _n = ( _s = _i . next ( ) ) . done ) ; _n = true ) { _arr . push ( _s . value ) ; if ( i && _arr . length === i ) break ; } } catch ( err ) { _d = true ; _e = err ; } finally { try { if ( ! _n && _i [ "return" ] != null ) _i [ "return" ] ( ) ; } finally { if ( _d ) throw _e ; } } return _arr ; }
15+ function _iterableToArrayLimit ( arr , i ) { if ( typeof Symbol === "undefined" || ! ( Symbol . iterator in Object ( arr ) ) ) return ; var _arr = [ ] ; var _n = true ; var _d = false ; var _e = undefined ; try { for ( var _i = arr [ Symbol . iterator ] ( ) , _s ; ! ( _n = ( _s = _i . next ( ) ) . done ) ; _n = true ) { _arr . push ( _s . value ) ; if ( i && _arr . length === i ) break ; } } catch ( err ) { _d = true ; _e = err ; } finally { try { if ( ! _n && _i [ "return" ] != null ) _i [ "return" ] ( ) ; } finally { if ( _d ) throw _e ; } } return _arr ; }
1816
1917function _arrayWithHoles ( arr ) { if ( Array . isArray ( arr ) ) return arr ; }
2018
21- function _toConsumableArray ( arr ) { return _arrayWithoutHoles ( arr ) || _iterableToArray ( arr ) || _nonIterableSpread ( ) ; }
19+ function _toConsumableArray ( arr ) { return _arrayWithoutHoles ( arr ) || _iterableToArray ( arr ) || _unsupportedIterableToArray ( arr ) || _nonIterableSpread ( ) ; }
20+
21+ function _nonIterableSpread ( ) { throw new TypeError ( "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ; }
22+
23+ function _unsupportedIterableToArray ( o , minLen ) { if ( ! o ) return ; if ( typeof o === "string" ) return _arrayLikeToArray ( o , minLen ) ; var n = Object . prototype . toString . call ( o ) . slice ( 8 , - 1 ) ; if ( n === "Object" && o . constructor ) n = o . constructor . name ; if ( n === "Map" || n === "Set" ) return Array . from ( n ) ; if ( n === "Arguments" || / ^ (?: U i | I ) n t (?: 8 | 1 6 | 3 2 ) (?: C l a m p e d ) ? A r r a y $ / . test ( n ) ) return _arrayLikeToArray ( o , minLen ) ; }
2224
23- function _nonIterableSpread ( ) { throw new TypeError ( "Invalid attempt to spread non-iterable instance" ) ; }
25+ function _iterableToArray ( iter ) { if ( typeof Symbol !== "undefined" && Symbol . iterator in Object ( iter ) ) return Array . from ( iter ) ; }
2426
25- function _iterableToArray ( iter ) { if ( Symbol . iterator in Object ( iter ) || Object . prototype . toString . call ( iter ) === "[object Arguments]" ) return Array . from ( iter ) ; }
27+ function _arrayWithoutHoles ( arr ) { if ( Array . isArray ( arr ) ) return _arrayLikeToArray ( arr ) ; }
2628
27- function _arrayWithoutHoles ( arr ) { if ( Array . isArray ( arr ) ) { for ( var i = 0 , arr2 = new Array ( arr . length ) ; i < arr . length ; i ++ ) { arr2 [ i ] = arr [ i ] ; } return arr2 ; } }
29+ function _arrayLikeToArray ( arr , len ) { if ( len == null || len > arr . length ) len = arr . length ; for ( var i = 0 , arr2 = new Array ( len ) ; i < len ; i ++ ) { arr2 [ i ] = arr [ i ] ; } return arr2 ; }
2830
2931function ownKeys ( object , enumerableOnly ) { var keys = Object . keys ( object ) ; if ( Object . getOwnPropertySymbols ) { var symbols = Object . getOwnPropertySymbols ( object ) ; if ( enumerableOnly ) symbols = symbols . filter ( function ( sym ) { return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ; } ) ; keys . push . apply ( keys , symbols ) ; } return keys ; }
3032
@@ -38,10 +40,14 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
3840
3941function _createClass ( Constructor , protoProps , staticProps ) { if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) _defineProperties ( Constructor , staticProps ) ; return Constructor ; }
4042
43+ function _createSuper ( Derived ) { return function ( ) { var Super = _getPrototypeOf ( Derived ) , result ; if ( _isNativeReflectConstruct ( ) ) { var NewTarget = _getPrototypeOf ( this ) . constructor ; result = Reflect . construct ( Super , arguments , NewTarget ) ; } else { result = Super . apply ( this , arguments ) ; } return _possibleConstructorReturn ( this , result ) ; } ; }
44+
4145function _possibleConstructorReturn ( self , call ) { if ( call && ( _typeof ( call ) === "object" || typeof call === "function" ) ) { return call ; } return _assertThisInitialized ( self ) ; }
4246
4347function _assertThisInitialized ( self ) { if ( self === void 0 ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return self ; }
4448
49+ function _isNativeReflectConstruct ( ) { if ( typeof Reflect === "undefined" || ! Reflect . construct ) return false ; if ( Reflect . construct . sham ) return false ; if ( typeof Proxy === "function" ) return true ; try { Date . prototype . toString . call ( Reflect . construct ( Date , [ ] , function ( ) { } ) ) ; return true ; } catch ( e ) { return false ; } }
50+
4551function _getPrototypeOf ( o ) { _getPrototypeOf = Object . setPrototypeOf ? Object . getPrototypeOf : function _getPrototypeOf ( o ) { return o . __proto__ || Object . getPrototypeOf ( o ) ; } ; return _getPrototypeOf ( o ) ; }
4652
4753function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function" ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , writable : true , configurable : true } } ) ; if ( superClass ) _setPrototypeOf ( subClass , superClass ) ; }
@@ -69,16 +75,18 @@ var bom_utf8 = Buffer.from([239, 187, 191]);
6975var Parser = /*#__PURE__*/ function ( _Transform ) {
7076 _inherits ( Parser , _Transform ) ;
7177
78+ var _super = _createSuper ( Parser ) ;
79+
7280 function Parser ( ) {
7381 var _this ;
7482
7583 var opts = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
7684
7785 _classCallCheck ( this , Parser ) ;
7886
79- _this = _possibleConstructorReturn ( this , _getPrototypeOf ( Parser ) . call ( this , _objectSpread ( { } , {
87+ _this = _super . call ( this , _objectSpread ( { } , {
8088 readableObjectMode : true
81- } , { } , opts ) ) ) ;
89+ } , { } , opts ) ) ;
8290 var options = { } ; // Merge with user options
8391
8492 for ( var opt in opts ) {
@@ -875,7 +883,16 @@ var Parser = /*#__PURE__*/function (_Transform) {
875883
876884 for ( var i = 0 , l = record . length ; i < l ; i ++ ) {
877885 if ( columns [ i ] === undefined || columns [ i ] . disabled ) continue ;
878- obj [ columns [ i ] . name ] = record [ i ] ;
886+
887+ if ( obj [ columns [ i ] . name ] ) {
888+ if ( Array . isArray ( obj [ columns [ i ] . name ] ) ) {
889+ obj [ columns [ i ] . name ] = obj [ columns [ i ] . name ] . concat ( record [ i ] ) ;
890+ } else {
891+ obj [ columns [ i ] . name ] = [ obj [ columns [ i ] . name ] , record [ i ] ] ;
892+ }
893+ } else {
894+ obj [ columns [ i ] . name ] = record [ i ] ;
895+ }
879896 }
880897
881898 var objname = this . options . objname ;
@@ -1291,13 +1308,15 @@ var parse = function parse() {
12911308var CsvError = /*#__PURE__*/ function ( _Error ) {
12921309 _inherits ( CsvError , _Error ) ;
12931310
1311+ var _super2 = _createSuper ( CsvError ) ;
1312+
12941313 function CsvError ( code , message ) {
12951314 var _this2 ;
12961315
12971316 _classCallCheck ( this , CsvError ) ;
12981317
12991318 if ( Array . isArray ( message ) ) message = message . join ( ' ' ) ;
1300- _this2 = _possibleConstructorReturn ( this , _getPrototypeOf ( CsvError ) . call ( this , message ) ) ;
1319+ _this2 = _super2 . call ( this , message ) ;
13011320
13021321 if ( Error . captureStackTrace !== undefined ) {
13031322 Error . captureStackTrace ( _assertThisInitialized ( _this2 ) , CsvError ) ;
0 commit comments