optionally

Type: function
Returns Some of k existing in o, otherwise return None; if a function was provided, returns the result of k in o for that function as its parameter.

Body

function(o,k,func){
  try {
    if (k in o){
      if (func !== undefined){
        return Some(func(o[k]));
      } else {
        return Some(o[k]);
      }
    } else {
      return None;
    }
  } catch (ex){
    error('exception in optionally',o,k,ex);
    return None;
  }
}

Classpath

Children