Re: Link.js v0.3.0
Reply #224 –
So I've put out v0.3.0, it's still in beta since I'm still testing it. I'm upping the minor version count and not the patch count because I added a new feature that changes the behavior of Link. Now it will recognize the array index at every step of the way. This is a minor, minor speed hit but now you have access to an arrays index in each function call:
Link([1, 2, 3]).map(function(item, i) { return item + i; }).toArray(); // [1, 3, 5] (new array)
Because of this newly added feature I've now added something I've thought of for a very long time. I originally didn't want this behavior because I found it "destructive" but now I think it has a use and so I'm adding it at your own risk.
Link([1, 2, 3]).map(function(item, i) { return item + i; }).fuse(); // [1, 3, 5] (same array)
It'll modify the original array. I also call the feature '.coalesce()' but fuse is probably easier to type and remember. It synergizes well with .pluck:
Link(array).pluck('apples').map(worms).fuse('apples');
Before this, there was no easy way to access the originating array after a pluck. Now you can pluck something out, do work and fuse it back by using the same property you plucked from, or you can use a different property and store results of the Link expression into another property of the object in the array.
Currently it's only an end point, but I will soon add a non-end point variants so we can jump around the array at will and puck/fuse/pluck other properties at will. This is why the version is at 0.3.0 and I thank you all so far for using it.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.
Sphere-sfml
hereSphere Studio editor
here