reactive-extensions / ixjs Goto Github PK
View Code? Open in Web Editor NEWInteractive Extensions for JavaScript
License: Other
Interactive Extensions for JavaScript
License: Other
Hi
It looks like the Wiki can be modified by anyone. There was what looked like Spam page which I edited and deleted. Thought you might like to know.
Aside from the obvious need of covering all operators, perhaps it would make them even more useful if there was an embedded Plunker/CodePen widget that demonstrates the functionality? Same point goes (and is likely even more relevant) for the RxJS docs.
https://github.com/Reactive-Extensions/IxJS/blob/master/src/core/enumerable.js#L1615
https://github.com/Reactive-Extensions/IxJS/blob/master/src/core/enumerable.js#L1611
for those that run into this, here is an augmentation to patch the issue until it's fixed. I'll try and get a PR for this issue pushed up asap.
import { Enumerable, OrderedEnumerable, Comparer } from 'ix';
// we want to reuse the createOrderedEnumerable that comes with OrderedEnumerable
interface OrderedEnumerablePrototype<T> extends OrderedEnumerable<T> {
createOrderedEnumerable<TKey>(keySelector: (item: T) => TKey, comparer: Comparer<TKey, TKey> | undefined, descending: boolean): OrderedEnumerable<T>;
}
// reach in and grab the OrderedEnumerable prototype by creating an ordered enumerable
const orderedEnumerablePrototype: OrderedEnumerablePrototype<any> = (<any>Enumerable)
.empty()
.orderBy(undefined)
.__proto__
.constructor
.prototype;
function thenBy<T, TKey>(
this: OrderedEnumerablePrototype<T>,
keySelector: (item: T) => TKey,
comparer?: Comparer<TKey, TKey>,
) {
return this.createOrderedEnumerable(keySelector, comparer, false);
}
orderedEnumerablePrototype.thenBy = thenBy;
function thenByDescending<T, TKey>(
this: OrderedEnumerablePrototype<T>,
keySelector: (item: T) => TKey,
comparer?: Comparer<TKey, TKey>,
) {
return this.createOrderedEnumerable(keySelector, comparer, true);
}
orderedEnumerablePrototype.thenByDescending = thenByDescending;
It is supposed to work as a left outer join, but instead it throws an error if the inner sequence has no matching elements to any of the outer elements.
This will throw an error:
Ix.Enumerable.fromArray([1])
.groupJoin(
Ix.Enumerable.empty(),
function (v) { return v; },
function (v) { return v; },
function (o,i) { return o; })
.toArray();
It should return [1].
ix.js
requires Ix
on AMD loading (from ix.js):
if (typeof define === 'function' && define.amd) {
define(['Ix', 'exports'], function (Ix, exports) {
root.Ix = factory(root, exports, Ix);
return root.Ix;
});
}
but Ix
not defined by l2o
.
I think it should be:
define(['./l2o', 'exports'], ...
There's a bug in the newly added catch statement that prevents grunt task from finishing.
https://github.com/Reactive-Extensions/IxJS/blob/master/src/core/enumerable.js#L347
Also, the method doesn't work like its LINQ equivalent. Is this behaviour correct?
Are there any benchmark results on how I2o & Ix compare to libraries like lodash ?
Is there a way I can pipe an IxJS stream to a node stream and vice versa?
Hi!
Just looking through the code, I noticed that when calling singleOrDefault
with a predicate, the call is first forwarded to where
, and then a single result is returned from that.
In src/core/enumerable.js (line 982):
EnumerablePrototype.singleOrDefault = function (predicate) {
if (predicate) {
return this.where(predicate).single();
}
...
}
if I'm not mistaken, shouldn't that be a call to singleOrDefault()
, rather than single()
?
I've always understood Enumerable.generate() to approximate for-loop style control flow. Is this wrong? Whereas the for-loop prints nothing, the generate
example prints an undefined value to the console.
var arr = ["a", "b", "c"];
for(var i = 3; i < arr.length; ++i) {
console.log(arr[i]);
}
// prints nothing
var arr = ["a", "b", "c"];
Enumerable.generate(
3,
function(i) { return i < arr.length; },
function(i) { return i + 1; },
function(i) { return arr[i]; }
).forEach(console.log.bind(console));
// prints `undefined`
It seems like ES2015 generator functions would be a perfect fit for Ix, and might lead to better performance as browsers add generator support. Is there a roadmap to use them in the near future?
for
/forIn
in ix.js
defined as:
function (source, resultSelector) {
return source.select(resultSelector);
};
but the description is: Generates a sequence by enumerating a source sequence, mapping its elements on result sequences, and concatenating those sequences.
I think it should use selectMany
instead of select
. Am I right?
Using requirejs, using the follwing configuration for the package:
"packages": [{
"name": "ix",
"main": "ix.js"
}]
now when I try to require ix, it will try and fetch Ix.js because this is references from the ix library.
This seems to be causing trouble:
define(['Ix', 'exports'], function (Ix, exports) {
By renaming Ix to ix, the proper files get loaded, but I get a
Uncaught TypeError: Cannot read property 'isEqual' of undefined
I just use the l2o.js script, which is fine. What is the ix.js script for anyway?
I think moving the l2o to a seperate repository, keeping the name lowercase would solve all problems. I really love Linq and I use l2o a lot. It would be great if there was more development in the project. Maybe a different repo can also achieve that.
Instructions on the front page say that
bower install ix
should work, but instead it produces an error:
bower ENOTFOUND Package ix not found
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.