function convertExpand(aExpands, mExpandItem, sPathPrefix) {
			if (!mExpandItem || typeof mExpandItem !== "object") {
				throw new Error("$expand must be a valid object");
			}

			Object.keys(mExpandItem).forEach(function (sExpandPath) {
				var sAbsoluteExpandPath = _Helper.buildPath(sPathPrefix, sExpandPath),
					vExpandOptions = mExpandItem[sExpandPath]; // an object or true

				aExpands.push(sAbsoluteExpandPath);

				if (typeof vExpandOptions === "object") {
					Object.keys(vExpandOptions).forEach(function (sQueryOption) {
						switch (sQueryOption) {
							case "$expand":
								// process nested expands
								convertExpand(aExpands, vExpandOptions.$expand,
									sAbsoluteExpandPath);
								break;
							case "$select":
								// process nested selects
								addSelects(vExpandOptions.$select, sAbsoluteExpandPath);
								break;
							default:
								throw new Error("Unsupported query option in $expand: "
									+ sQueryOption);
						}
					});
				}
				if (!vExpandOptions.$select) {
					mSelects[sAbsoluteExpandPath + "/*"] = true;
				}
			});
			return aExpands;
		}
/*
		 * Converts the V4 $expand options to flat V2 $expand and $select structure.
		 *
		 * @param {string[]} aExpands The resulting list of $expand paths
		 * @param {object} mExpandItem The current $expand item to be processed
		 * @param {string} sPathPrefix The path prefix used to compute the absolute path
		 * @returns {string[]} The list of $expand paths
		 * @throws {Error}
		 *   If a system query option other than $expand and $select is used or if any $expand value
		 *   is not an object
		 */
Converts the V4 $expand options to flat V2 $expand and $select structure.
Converts the V4 $expand options to flat V2 $expand and $select structure .
function convertExpand(aExpands, mExpandItem, sPathPrefix) {
			if (!mExpandItem || typeof mExpandItem !== "object") {
				throw new Error("$expand must be a valid object");
			}
			Object.keys(mExpandItem).forEach(function (sExpandPath) {
				var sAbsoluteExpandPath = _Helper.buildPath(sPathPrefix, sExpandPath),
					vExpandOptions = mExpandItem[sExpandPath]; 
				aExpands.push(sAbsoluteExpandPath);
				if (typeof vExpandOptions === "object") {
					Object.keys(vExpandOptions).forEach(function (sQueryOption) {
						switch (sQueryOption) {
							case "$expand":
								convertExpand(aExpands, vExpandOptions.$expand,
									sAbsoluteExpandPath);
								break;
							case "$select":
								addSelects(vExpandOptions.$select, sAbsoluteExpandPath);
								break;
							default:
								throw new Error("Unsupported query option in $expand: "
									+ sQueryOption);
						}
					});
				}
				if (!vExpandOptions.$select) {
					mSelects[sAbsoluteExpandPath + "/*"] = true;
				}
			});
			return aExpands;
		}
function convertExpand ( aExpands , mExpandItem , sPathPrefix ) { if ( ! mExpandItem || typeof mExpandItem !== "object" ) { throw new Error ( "$expand must be a valid object" ) ; } Object . keys ( mExpandItem ) . forEach ( function ( sExpandPath ) { var sAbsoluteExpandPath = _Helper . buildPath ( sPathPrefix , sExpandPath ) , vExpandOptions = mExpandItem [ sExpandPath ] ; aExpands . push ( sAbsoluteExpandPath ) ; if ( typeof vExpandOptions === "object" ) { Object . keys ( vExpandOptions ) . forEach ( function ( sQueryOption ) { switch ( sQueryOption ) { case "$expand" : convertExpand ( aExpands , vExpandOptions . $expand , sAbsoluteExpandPath ) ; break ; case "$select" : addSelects ( vExpandOptions . $select , sAbsoluteExpandPath ) ; break ; default : throw new Error ( "Unsupported query option in $expand: " + sQueryOption ) ; } } ) ; } if ( ! vExpandOptions . $select ) { mSelects [ sAbsoluteExpandPath + "/*" ] = true ; } } ) ; return aExpands ; }
Converts the V4 $expand options to flat V2 $expand and $select structure.
Converts the V4 $expand options to flat V2 $expand and $select structure .
// an object or true // process nested expands // process nested selects