src/js/utils.js
branchpopcorn-port
changeset 820 7968346b9689
parent 720 08b8b3ce30e4
child 830 18ca612e9ff0
equal deleted inserted replaced
819:9b8e68803f6f 820:7968346b9689
   155 /** test if a value is null or undefined */
   155 /** test if a value is null or undefined */
   156 IriSP.null_or_undefined = function(val) {
   156 IriSP.null_or_undefined = function(val) {
   157   return (typeof(val) === "undefined" || val === null);
   157   return (typeof(val) === "undefined" || val === null);
   158 };
   158 };
   159 
   159 
       
   160 /** get a property that can have multiple names **/
       
   161 
       
   162 IriSP.get_aliased = function(_obj, _aliases) {
       
   163     for (var _i = 0; _i < _aliases.length; _i++) {
       
   164         if (typeof _obj[_aliases[_i]] !== "undefined") {
       
   165             return _obj[_aliases[_i]];
       
   166         }
       
   167     }
       
   168     return null;
       
   169 }
       
   170 
   160 /** issue a call to an url shortener and return the shortened url */
   171 /** issue a call to an url shortener and return the shortened url */
   161 IriSP.shorten_url = function(url) {
   172 IriSP.shorten_url = function(url) {
   162   if (IriSP.config.shortener.hasOwnProperty("shortening_function"))
   173   if (IriSP.config.shortener.hasOwnProperty("shortening_function"))
   163     return IriSP.config.shortener.shortening_function(url);
   174     return IriSP.config.shortener.shortening_function(url);
   164     
   175