util: more strict check for bool/number/string

This commit is contained in:
Yorkie
2013-12-15 05:09:28 +08:00
committed by Fedor Indutny
parent 8a79cca80c
commit 95ee84fabe
4 changed files with 39 additions and 5 deletions

View File

@@ -118,7 +118,7 @@ var stringifyPrimitive = function(v) {
if (util.isString(v))
return v;
if (util.isBoolean(v))
return v ? 'true' : 'false';
return v == true ? 'true' : 'false';
if (util.isNumber(v))
return isFinite(v) ? v : '';
return '';