Implement recover method of JavaScript Future.

Create new successful future with given callback when the current future
is failed. And if the current future is successful the new future
contains the same result as the current future.
Implement flatMap method of JavaScript Future.

Similar to map but it takes function that returns future and the result
is the future returned by the function.
Implement transform method of JavaScript Future.

Create new future. This method takes two function, the first function is
applied when the current future is successful and the second function is
applied when the current future is failed.