src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (oInstance, sMetaPath, mTypeForMetaPath, bReturnAlias) {
			var bFailed,
				mKey2Value = {};

			bFailed = mTypeForMetaPath[sMetaPath].$Key.some(function (vKey) {
				var sKey, sKeyPath, aPath, sPropertyName, oType, vValue;

				if (typeof vKey === "string") {
					sKey = sKeyPath = vKey;
				} else {
					sKey = Object.keys(vKey)[0]; // alias
					sKeyPath = vKey[sKey];
					if (!bReturnAlias) {
						sKey = sKeyPath;
					}
				}
				aPath = sKeyPath.split("/");

				vValue = _Helper.drillDown(oInstance, aPath);
				if (vValue === undefined) {
					return true;
				}

				// the last path segment is the name of the simple property
				sPropertyName = aPath.pop();
				// find the type containing the simple property
				oType = mTypeForMetaPath[_Helper.buildPath(sMetaPath, aPath.join("/"))];
				vValue = _Helper.formatLiteral(vValue, oType[sPropertyName].$Type);
				mKey2Value[sKey] = vValue;
			});

			return bFailed ? undefined : mKey2Value;
		}
function (oInstance, sMetaPath, mTypeForMetaPath, bReturnAlias) {
			var bFailed,
				mKey2Value = {};

			bFailed = mTypeForMetaPath[sMetaPath].$Key.some(function (vKey) {
				var sKey, sKeyPath, aPath, sPropertyName, oType, vValue;

				if (typeof vKey === "string") {
					sKey = sKeyPath = vKey;
				} else {
					sKey = Object.keys(vKey)[0]; // alias
					sKeyPath = vKey[sKey];
					if (!bReturnAlias) {
						sKey = sKeyPath;
					}
				}
				aPath = sKeyPath.split("/");

				vValue = _Helper.drillDown(oInstance, aPath);
				if (vValue === undefined) {
					return true;
				}

				// the last path segment is the name of the simple property
				sPropertyName = aPath.pop();
				// find the type containing the simple property
				oType = mTypeForMetaPath[_Helper.buildPath(sMetaPath, aPath.join("/"))];
				vValue = _Helper.formatLiteral(vValue, oType[sPropertyName].$Type);
				mKey2Value[sKey] = vValue;
			});

			return bFailed ? undefined : mKey2Value;
		}
function ( oInstance , sMetaPath , mTypeForMetaPath , bReturnAlias ) { var bFailed , mKey2Value = { } ; bFailed = mTypeForMetaPath [ sMetaPath ] . $Key . some ( function ( vKey ) { var sKey , sKeyPath , aPath , sPropertyName , oType , vValue ; if ( typeof vKey === "string" ) { sKey = sKeyPath = vKey ; } else { sKey = Object . keys ( vKey ) [ 0 ] ; // alias sKeyPath = vKey [ sKey ] ; if ( ! bReturnAlias ) { sKey = sKeyPath ; } } aPath = sKeyPath . split ( "/" ) ; vValue = _Helper . drillDown ( oInstance , aPath ) ; if ( vValue === undefined ) { return true ; } // the last path segment is the name of the simple property sPropertyName = aPath . pop ( ) ; // find the type containing the simple property oType = mTypeForMetaPath [ _Helper . buildPath ( sMetaPath , aPath . join ( "/" ) ) ] ; vValue = _Helper . formatLiteral ( vValue , oType [ sPropertyName ] . $Type ) ; mKey2Value [ sKey ] = vValue ; } ) ; return bFailed ? undefined : mKey2Value ; }
Returns the key properties mapped to values from the given entity using the given
meta data.

@param {object} oInstance
Entity instance runtime data
@param {string} sMetaPath
The absolute meta path of the given instance
@param {object} mTypeForMetaPath
Maps meta paths to the corresponding entity or complex types
@param {boolean} [bReturnAlias=false]
Whether to return the aliases instead of the keys
@returns {object}
The key properties map. For the meta data
<Key>
<PropertyRef Name="Info/ID" Alias="EntityInfoID"/>
</Key>
the following map is returned:
- {EntityInfoID : 42}, if bReturnAlias = true;
- {"Info/ID" : 42}, if bReturnAlias = false;
- undefined, if at least one key property is undefined.
@throws {Error}
In case the entity type has no key properties according to metadata
Returns the key properties mapped to values from the given entity using the given meta data .