Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fold issues with ES5 #669

Closed
nogo10 opened this issue Jun 30, 2016 · 4 comments
Closed

fold issues with ES5 #669

nogo10 opened this issue Jun 30, 2016 · 4 comments

Comments

@nogo10
Copy link

nogo10 commented Jun 30, 2016

As shown on stackoverflow question
ES6 arrow function " => " works fine with observable.fold(seed, f)

const stream = Bacon.sequentially(100, ["Hello", "world"])    
stream.log("stream")
const concatenated = stream.fold("", (a,b) => a + b)
concatenated.log("concatenated")

However in strict ES5 syntax:

var stream = Bacon.sequentially(100, ["Hello", "world"]);
stream.log("stream");
var concatenated = stream.fold("", function (a,b){ a + b});

it doesn't work results in 'undefined' value on console

@raimohanska
Copy link
Contributor

You're missing a return statement :)

@darrennolan
Copy link

Because you've missed a return.

const concatenated = stream.fold("", (a,b) => a + b)

In es5 is actually

var concatenated = stream.fold("", function (a,b){ return a + b});

On Thu, 30 Jun 2016 4:42 pm Juha Paananen notifications@github.com wrote:

Closed #669 #669.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#669 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ABEGa8wl9YP9IuipqDLCo4CHLlwbmKtsks5qQ2VMgaJpZM4JBwHK
.

@darrennolan
Copy link

Sorry... Slow to the thread.

On Thu, 30 Jun 2016 5:39 pm Darren Nolan me@darrennolan.com wrote:

Because you've missed a return.

const concatenated = stream.fold("", (a,b) => a + b)

In es5 is actually

var concatenated = stream.fold("", function (a,b){ return a + b});

On Thu, 30 Jun 2016 4:42 pm Juha Paananen notifications@github.com
wrote:

Closed #669 #669.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#669 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ABEGa8wl9YP9IuipqDLCo4CHLlwbmKtsks5qQ2VMgaJpZM4JBwHK
.

@nogo10
Copy link
Author

nogo10 commented Jul 1, 2016

Ok -thanks- solved for me ..im the slow one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants