From 29f008587c3e56ccbd313f83fccc108c8d47a2be Mon Sep 17 00:00:00 2001 From: Andrew Bonnell Date: Thu, 24 Jun 2021 13:03:20 -0700 Subject: [PATCH] typeof check for string, if string cast data as array for map function --- src/ApiClient.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ApiClient.js b/src/ApiClient.js index f338cb30..56276e9b 100644 --- a/src/ApiClient.js +++ b/src/ApiClient.js @@ -688,6 +688,11 @@ } else if (Array.isArray(type)) { // for array type like: ['String'] var itemType = type[0]; + if (typeof(data) === 'string') { + return [data].map(function(item) { + return exports.convertToType(item, itemType); + }); + } return data.map(function(item) { return exports.convertToType(item, itemType); });