nl_tokens: / * convert OrderArray : [ Order : [ ... ] ] structure to Orders : [] .
pl_tokens: function _flattenSillyArray ( parentObj , key , requestContext ) { //debug('_flattenSillyArray', key, parentObj[key]); var subKey = key . replace ( / Array$ / , '' ) ; // e.g. 'Order' from 'OrderArray' var newKey = subKey + 's' ; // e.g. 'Orders' // `compact` avoids creating an array of `[undefined]`, // from input `['']` when xml "array" element was empty. parentObj [ newKey ] = _ . compact ( parentObj [ key ] [ 0 ] [ subKey ] ) ; delete parentObj [ <mask> ] ; // might have already been flattened... if ( ! _ . isArray ( parentObj [ newKey ] ) ) parentObj [ newKey ] = [ parentObj [ newKey ] ] ; parentObj [ newKey ] = parentObj [ newKey ] . map ( function ( subObj ) { return exports . flatten ( subObj , - 1 , requestContext ) ; } ) ; return newKey ; }