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

chaining with each is not skipping the function passed to each #47

Closed
atondelier opened this issue Jun 3, 2015 · 2 comments
Closed
Labels
Milestone

Comments

@atondelier
Copy link

Compiling a chain into a raw callback composition is a very good idea. As of now, there are some bugs with it.

An exemple is better than long explanations. The following code:

blocks([0,1,2])
.each(function(v) { console.log('first each', v); })
.each(function(v) { console.log('second each', v); })
.map(function(v) { console.log('first map', v); return v; })
.map(function(v) { console.log('second map', v); return v; })
.value();

is logging this:

first each 0
first each 1
first each 2
first each 0
second each 0
first each 1
second each 1
first each 2
second each 2
first each 0
second each 0
first map 0
second map 0
first each 1
second each 1
first map 1
second map 1
first each 2
second each 2
first map 2
second map 2

We see 2 things:

  • the second "each" is recalling the first one
  • the 2 cleverly composed "map" are recalling both "each"
@astoilkov astoilkov added the bug label Jun 3, 2015
@astoilkov
Copy link
Owner

I am in a progress of deciding to remove the built-in utility library and switch to using Lodash instead. The current implementation is not stable enough and I don't see a benefit of using it when comparing it to Lodash. I will release the library as an individual project. If it becomes more stable I could then include it in jsblocks.

What do you think?

@astoilkov astoilkov added this to the 0.4.0 milestone Jun 5, 2015
@astoilkov
Copy link
Owner

I have created a separate issue that will do what I told you. I am closing this one and copying the issue to the jsvalue repo (which is currently private repository).

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

No branches or pull requests

2 participants