etnbrd/flx-compiler

View on GitHub
test-set/Moonridge-master/when-test.js

Summary

Maintainability
A
0 mins
Test Coverage
var Promise = require('bluebird');

Promise.when = function(promiseOrValue) {
  if (typeof promiseOrValue === 'object' && typeof promiseOrValue.then === 'function') {
    return promiseOrValue;
  } else {
    var dfd = Promise.defer();
    dfd.resolve(promiseOrValue);
    return dfd.promise;
  }
};

Promise.when({a:11}).then(function(val){
    console.log("val", val);
});