From: Sunggyu Choi Date: Thu, 29 Jan 2015 08:03:09 +0000 (+0900) Subject: [utils] modified _toPlatformObject() to handle array input type X-Git-Tag: submit/tizen_tv/20150603.064601~1^2~535^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b49d045840c4f4896791d843d1df361ee3c0197;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [utils] modified _toPlatformObject() to handle array input type - replyResult() has a optional parameter as array type. previous _toPlatformObject() can't handle this case. - removed lint error [verification] self test Change-Id: I970a47447bc7571ba8cee7741d69e7d247682ccb Signed-off-by: Sunggyu Choi --- diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js index 64ebb783..87c2f71b 100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -236,7 +236,14 @@ Converter.prototype.toString = function(val, nullable) { }; function _toPlatformObject(val, types) { + var v; var t; + if (_type.isArray(val)) { + v = val; + } else { + v = [val]; + } + if (_type.isArray(types)) { t = types; } else { @@ -244,7 +251,9 @@ function _toPlatformObject(val, types) { } var match = false; for (var i = 0; i < t.length; ++i) { - match = match || (val instanceof t[i]); + for (var j = 0; j < v.length; ++j) { + match = match || (v[j] instanceof t[i]); + } } if (match) { return val;