GithubHelp home page GithubHelp logo

ixjs's People

Contributors

elmerbulthuis avatar leecampbell avatar mattpodwysocki avatar mvschaik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ixjs's Issues

Wiki is open for anyone to edit

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.

Docs need some work

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.

thenByDescending sorts ascending, thenBy ignores comparer

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;

groupJoin throws exception if outer sequence contains elements without inner sequence

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 - AMD loading error

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'], ...

Perf Comparison

Are there any benchmark results on how I2o & Ix compare to libraries like lodash ?

SingleOrDefault error

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()?

Enumerable.generate enumerates the initial value, even if it doesn't pass the condition selector.

@mattpodwysocki

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`

ES2015 Generators

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?

ix.js: for/forIn looks strange

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?

npm version can not be used as a module

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.