2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -89,9 +89,10 @@ function emitDone(conv) {
89
89
90
90
91
91
function bufFromString ( str ) {
92
+ var length = Buffer . byteLength ( str ) ;
92
93
var buffer = Buffer . allocUnsafe
93
- ? Buffer . allocUnsafe ( str . length )
94
- : new Buffer ( str . length ) ;
94
+ ? Buffer . allocUnsafe ( length )
95
+ : new Buffer ( length ) ;
95
96
buffer . write ( str ) ;
96
97
return buffer ;
97
98
}
@@ -530,7 +531,9 @@ Converter.prototype.transf = function (func) {
530
531
531
532
Converter . prototype . fromString = function ( csvString , cb ) {
532
533
if ( typeof csvString !== "string" ) {
533
- return cb ( new Error ( "Passed CSV Data is not a string." ) ) ;
534
+ if ( cb && typeof cb === "function" ) {
535
+ return cb ( new Error ( "Passed CSV Data is not a string." ) ) ;
536
+ }
534
537
}
535
538
if ( cb && typeof cb === "function" ) {
536
539
this . wrapCallback ( cb , function ( ) {
Original file line number Diff line number Diff line change 244
244
"hireable" : null
245
245
}
246
246
],
247
- "version" : " 1.1.8 " ,
247
+ "version" : " 1.1.9 " ,
248
248
"keywords" : [
249
249
" csv" ,
250
250
" csv parser" ,
0 commit comments