Re: Link.js v0.4.0
Reply #271 –
I've updated Link to 0.4.0
Changes
- Added Cross Product
- Added LinkException
- Parameters that take arrays, can now also take link contexts.
The Cross Product:
var items1 = ["A", "B"];
var items2 = ["C", "D"];
Link(items1).cross(items2).each(function(item, index) {
Print("Item at: "+ index);
Print(item); // e.g: ["A", "C"] or ["B", "D"]
});
Index is the number 0..n where n is the number of total items in the final list after the cross product has resolved.
Item is an array whose contents [0..m] is the m times of cross products you do. In the above example, it will contain an array with indices at [0, 1].
You might have noticed in another thread here I had used item.A, item.B, and item.C to denote the items that result from the cross product, for each join. But I deemed the internal method to figure that out too slow. A basic array with the items is sufficient enough. It's now [item1, item2, itemN, ...]