From 4b49d045840c4f4896791d843d1df361ee3c0197 Mon Sep 17 00:00:00 2001 From: Sunggyu Choi Date: Thu, 29 Jan 2015 17:03:09 +0900 Subject: [PATCH] [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 --- src/utils/utils_api.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js index 64ebb78..87c2f71 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; -- 2.7.4