src/js/utils.js
branchpopcorn-port
changeset 820 7968346b9689
parent 720 08b8b3ce30e4
child 830 18ca612e9ff0
--- a/src/js/utils.js	Tue Feb 21 17:26:51 2012 +0100
+++ b/src/js/utils.js	Wed Feb 29 18:13:14 2012 +0100
@@ -157,6 +157,17 @@
   return (typeof(val) === "undefined" || val === null);
 };
 
+/** get a property that can have multiple names **/
+
+IriSP.get_aliased = function(_obj, _aliases) {
+    for (var _i = 0; _i < _aliases.length; _i++) {
+        if (typeof _obj[_aliases[_i]] !== "undefined") {
+            return _obj[_aliases[_i]];
+        }
+    }
+    return null;
+}
+
 /** issue a call to an url shortener and return the shortened url */
 IriSP.shorten_url = function(url) {
   if (IriSP.config.shortener.hasOwnProperty("shortening_function"))