Giter VIP home page Giter VIP logo

multiplex.js's People

Contributors

dependabot[bot] avatar fossabot avatar knazeri avatar narrowizard 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

multiplex.js's Issues

'.../multiplex.d.ts' is not a module

Typescript 2.4.
'.../multiplex.d.ts' is not a module

while using the import syntax:
import * as mx from "multiplexjs";

Not sure about the exact resolution, I guess the definition should be different depending on global browser, or ES6 module usage.

My workround is to use:

import "multiplexjs"; // makes the mx type definition usable
const mx: mx.MultiplexStatic = require("multiplexjs"); // makes the mx static function available

Add `asEnumerable()` extension to Array and String prototype

// TODO: Set with Object define property, and set 'enumerable: false'
String.prototype.asEnumerable = function () {
  return mx(this);
};

Array.prototype.asEnumerable = function () {
  return mx(this);
};

Typescript definition:

interface String {
	asEnumerable(): mx.Enumerable<String>;
}

interface Array<T> {
	asEnumerable(): mx.Enumerable<T>;
}

The definition can only extend the built-in types if the definition is global, not a module. But in the current situation, that is the case.

it causes infinite loop when i test join method

Test Code

it causes infinite loop when i test join method with below code.

var data1 = [28, 26, 25, 24, 23, 21, 20, 19, 18, 16];

var data2 = [1, 2, 3, 4, 5, 6, 7, 8];
var data3 = mx(data1).join(data2, it => it, it => it, (a, b) => {
    return {
        Id: a
    }
}).toArray();
console.log(data3);

Linq and Xpath

Hi

I want to use multiplex as basis for data munging in js. Does multiplex cover this in total or should i be using an xpath library in conjunction with multiplex?

Should be able to deal with string hashes

For the hashtable: The generic hashtable functionality (insert, retrieve) seems to work using string hashes, but iteration check's whether the bucket's hash is >= zero, which is false for any string. As a fix you should probably use an equality check === rather than a numeric check, possibly defaulting the hash to null rather than 0.

Hash functions returning strings can be supplied by implementing your own EqualityComparer;

orderBy comparer has wrong signature

orderBy<TKey>(keySelector: (item: T) => TKey, comparer: EqualityComparer<TKey>): OrderedEnumerable<T>

should be:
orderBy<TKey>(keySelector: (item: T) => TKey, comparer: Comparer<TKey>): OrderedEnumerable<T>

and orderByDescending:
orderByDescending<TKey>(keySelector: (item: T) => TKey, comparer: Comparer<TKey>): OrderedEnumerable<T>

get error when using join method

test code:

var data1 = [{
    Id: 1,
    Name: "one"
}, {
    Id: 2,
    Name: "two"
}];

var data2 = [{
    Id: 1,
    Phone: 123456
}, {
    Id: 2,
    Phone: 654321
}];

var data3 = mx(data1).join(data2, it => it.Id, it => it.Id, (a, b) => {
    return {
        Id: a.Id,
        Name: a.Name,
        Phone: b.Phone
    }
}).toArray();
console.log(data3);

expected data:

image

got error:

image

i find the parameter error in src/lib/linq/_linq.js line 264:

image

fixed it and got unexpected data:

image

and I fix some logical in src/lib/linq/join.js and my test is passed.

count returns unexpected value with an object array.

i have an object array [{ Expression: "model" }, { Expression: "data" }] and i use mx to count the predicated items.

here is my code:

var data = [{ Expression: "model" }, { Expression: "data" }];
var c = mx(data).where(function (it) { return it.Expression == "data" }).count();
console.log(c);

it expected that c is 1,but got zero. the following code doesn't works either.

var data = [{ Expression: "model" }, { Expression: "data" }];
var c = mx(data).where(function (it) { return mx.equals(it.Expression, "data") }).count();
console.log(c);

is there any mistakes in my code?

forEach Typedefinition for List<T> incorrectly extends Collection<T>/Enumerable<T>

    TS2430: Interface 'List<T>' incorrectly extends interface 'Collection<T>'.
  Types of property 'forEach' are incompatible.
    Type '(action: (item: T) => void) => void' is not assignable to type '{ (action: (item: T) => void): void; (action: (item: T, index: number) => void): void; }'.
      Types of parameters 'action' and 'action' are incompatible. 

using Typescript 2.4.
The error can be resolved by removing the forEach declaration from List<T>, as it is inherited from
Enumerable<T> through Collection<T>.

Benchmarks

I'd love to see some benchmarks and how this compares to other js libraries like lodash, underscore, lazy, jlinq, etc...

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.