@@ -45,31 +45,32 @@ function arrayString(val) {
4545// note: you can override this function to provide your own conversion mechanism
4646// for complex types, etc...
4747var prepareValue = function ( val , seen ) {
48- // null and undefined are both null for postgres
49- if ( val == null ) {
50- return null
51- }
52- if ( val instanceof Buffer ) {
53- return val
54- }
55- if ( ArrayBuffer . isView ( val ) ) {
56- var buf = Buffer . from ( val . buffer , val . byteOffset , val . byteLength )
57- if ( buf . length === val . byteLength ) {
58- return buf
48+ if ( typeof val === 'object' ) {
49+ // null and undefined are both null for postgres
50+ if ( val == null ) {
51+ return null
5952 }
60- return buf . slice ( val . byteOffset , val . byteOffset + val . byteLength ) // Node.js v4 does not support those Buffer.from params
61- }
62- if ( val instanceof Date ) {
63- if ( defaults . parseInputDatesAsUTC ) {
64- return dateToStringUTC ( val )
65- } else {
66- return dateToString ( val )
53+ if ( val instanceof Buffer ) {
54+ return val
6755 }
68- }
69- if ( Array . isArray ( val ) ) {
70- return arrayString ( val )
71- }
72- if ( typeof val === 'object' ) {
56+ if ( ArrayBuffer . isView ( val ) ) {
57+ var buf = Buffer . from ( val . buffer , val . byteOffset , val . byteLength )
58+ if ( buf . length === val . byteLength ) {
59+ return buf
60+ }
61+ return buf . slice ( val . byteOffset , val . byteOffset + val . byteLength ) // Node.js v4 does not support those Buffer.from params
62+ }
63+ if ( val instanceof Date ) {
64+ if ( defaults . parseInputDatesAsUTC ) {
65+ return dateToStringUTC ( val )
66+ } else {
67+ return dateToString ( val )
68+ }
69+ }
70+ if ( Array . isArray ( val ) ) {
71+ return arrayString ( val )
72+ }
73+
7374 return prepareObject ( val , seen )
7475 }
7576 return val . toString ( )
0 commit comments