code: function asPromise (val) {
  	if (val && typeof val.then === 'function') {
  		return val;
  	}
  	var deferred = new PromiseFactory();
  	deferred.resolve(val);
  	return deferred.promise();
  }
docs: Helper function to return a resolved promise with a given value