code: function when (val, fn) {
    if (isPromise(val)) {
      return val.then(fn);
    } else {
      return fn(val);
    }
  }
docs: //////////////////// Public Functions // //////////////////// 
  When promise is fulfilled, then execute callback
  
  @param {*} val
  @param {Function} fn
  @return {*}