Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getEntityUrl(entity: any): string {
if (entity.hasOwnProperty("__metadata")) {
// we are dealing with verbose, which has an absolute uri
return entity.__metadata.uri;
} else if (entity.hasOwnProperty("odata.editLink")) {
// we are dealign with minimal metadata (default)
return Util.combinePaths("_api", entity["odata.editLink"]);
} else {
// we are likely dealing with nometadata, so don't error but we won't be able to
// chain off these objects (write something to log?)
Logger.write("No uri information found in ODataEntity parsing, chaining will fail for this object.", LogLevel.Warning);
return "";
}
}
function getEntityUrl(entity) {
if (entity.hasOwnProperty("__metadata")) {
return entity.__metadata.uri;
}
else if (entity.hasOwnProperty("odata.editLink")) {
return util_1.Util.combinePaths("_api", entity["odata.editLink"]);
}
else {
logging_1.Logger.write("No uri information found in ODataEntity parsing, chaining will fail for this object.", logging_1.LogLevel.Warning);
return "";
}
}
exports.ODataRaw = new ODataRawParserImpl();