From 77d1c86b86c5e513917cfa0b70d0998352404d9f Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Tue, 15 Jan 2013 15:26:56 +0300 Subject: [PATCH] Added boolean support to type matching --- common.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common.coffee b/common.coffee index ac1550a..ea0a705 100644 --- a/common.coffee +++ b/common.coffee @@ -1,5 +1,6 @@ UNDEFINED_TYPE = '[object Undefined]' NULL_TYPE = '[object Null]' +BOOLEAN_TYPE = '[object Boolean]' NUMBER_TYPE = '[object Number]' STRING_TYPE = '[object String]' ARRAY_TYPE = '[object Array]' @@ -48,6 +49,9 @@ exports.matchType = (src, dst) -> String(dst) when NUMBER_TYPE Number(dst) + when BOOLEAN_TYPE + v = String(dst).trim().toLowerCase() + v == 'true' or v == 'on' or v == '1' else dst