Skip to content

Commit 7faa2b3

Browse files
committed
utils: reorganize prepareValue conditional for clarity
Prefer positive tests; group tests for specific objects.
1 parent b778f2b commit 7faa2b3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/utils.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ var prepareValue = function(val) {
5252
if(val instanceof Date) {
5353
return dateToString(val);
5454
}
55-
if(typeof val === 'undefined') {
56-
return null;
57-
}
5855
if(Array.isArray(val)) {
5956
return arrayString(val);
6057
}
61-
if(!val || typeof val !== 'object') {
62-
return val === null ? null : val.toString();
58+
if(val === null || typeof val === 'undefined') {
59+
return null;
60+
}
61+
if(typeof val === 'object') {
62+
return JSON.stringify(val);
6363
}
64-
return JSON.stringify(val);
64+
return val.toString();
6565
};
6666

6767
function dateToString(date) {

0 commit comments

Comments
 (0)