update js samples

This commit is contained in:
wing328
2016-05-01 12:09:23 +08:00
parent 2d5cc50bd1
commit ab7b73ca21
20 changed files with 73 additions and 307 deletions

View File

@@ -463,6 +463,25 @@
}
};
/**
* Constructs a new map or array model from REST data.
* @param data {Object|Array} The REST data.
* @param obj {Object|Array} The target object or array.
*/
exports.constructFromObject = function(data, obj, itemType) {
if (Array.isArray(data)) {
for (var i = 0; i < data.length; i++) {
if (data.hasOwnProperty(i))
obj[i] = exports.convertToType(data[i], itemType);
}
} else {
for (var k in data) {
if (data.hasOwnProperty(k))
result[k] = exports.convertToType(data[k], itemType);
}
}
};
/**
* The default API client implementation.
* @type {module:ApiClient}