File tree Expand file tree Collapse file tree 3 files changed +36
-2
lines changed
Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 1+ ### 07/03/2017 0.4.6
2+ - Fixed issue #134
3+
4+ ### 06/26/2017 0.4.5
5+ - Added support to generate wireformat as a YAML doc
6+ - Improved the format to specify request body for a in a request using curl.
Original file line number Diff line number Diff line change @@ -303,7 +303,35 @@ exports.parseJsonWithPathFragments = function parseJsonWithPathFragments() {
303303 */
304304exports . mergeObjects = function mergeObjects ( source , target ) {
305305 Object . keys ( source ) . forEach ( function ( key ) {
306- target [ key ] = source [ key ] ;
306+ if ( Array . isArray ( source [ key ] ) ) {
307+ if ( target [ key ] && ! Array . isArray ( target [ key ] ) ) {
308+ throw new Error ( `Cannot merge ${ key } from source object into target object because the same property in target object is not (of the same type) an Array.` ) ;
309+ }
310+ if ( ! target [ key ] ) {
311+ target [ key ] = [ ] ;
312+ }
313+ target [ key ] = exports . mergeArrays ( source [ key ] , target [ key ] ) ;
314+ } else {
315+ target [ key ] = source [ key ] ;
316+ }
317+ } ) ;
318+ return target ;
319+ }
320+
321+ /*
322+ * Merges source array into the target array
323+ * @param {array } source The array that needs to be merged
324+ *
325+ * @param {array } target The array to be merged into
326+ *
327+ * @returns {array } target - Returns the merged target array.
328+ */
329+ exports . mergeArrays = function mergeArrays ( source , target ) {
330+ if ( ! Array . isArray ( target ) || ( ! Array . isArray ( source ) ) ) {
331+ return target ;
332+ }
333+ source . forEach ( ( item ) => {
334+ target . push ( item ) ;
307335 } ) ;
308336 return target ;
309337}
Original file line number Diff line number Diff line change 11{
22 "name" : " oav" ,
3- "version" : " 0.4.5 " ,
3+ "version" : " 0.4.6 " ,
44 "author" : {
55 "name" : " Microsoft Corporation" ,
66 "email" : " azsdkteam@microsoft.com" ,
You can’t perform that action at this time.
0 commit comments