Skip to content

Commit

Permalink
bind all lambdas to Enumerable
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaifm committed Apr 10, 2012
1 parent 5b68739 commit 53b1016
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This contains only the core library without the jquery or rx bindings.

Not much:

* All lambdas are bound to the Enumerable object
* Write and WriteLine functions modified to use `console.log` instead of `document.write`
* Minor changes to tests so they can be run on server side
* Sample tutorial is a .js file instead of .htm and can be run directly with node
Expand Down
4 changes: 2 additions & 2 deletions linq.js
Original file line number Diff line number Diff line change
Expand Up @@ -2109,12 +2109,12 @@ module.exports = (function ()
}
else if (expression.indexOf("=>") == -1)
{
return new Function("$,$$,$$$,$$$$", "return " + expression);
return new Function("$,$$,$$$,$$$$", "return " + expression).bind(Enumerable);
}
else
{
var expr = expression.match(/^[(\s]*([^()]*?)[)\s]*=>(.*)/);
return new Function(expr[1], "return " + expr[2]);
return new Function(expr[1], "return " + expr[2]).bind(Enumerable);
}
}
return expression;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "linq",
"author": "Mihai Ciuraru <[email protected]>",
"description": "linq.js - LINQ for JavaScript library packaged for node.js",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://github.com/mihaifm/linq",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion sample/tutorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ var answers = apart
.SelectMany(function(miller){ return apart
.Select(function(smith){ return {
baker: baker, cooper: cooper, fletcher: fletcher, miller: miller, smith: smith}})})})})})
.Where("Enumerable.From($).Distinct('$.Value').Count() == 5")
.Where("this.From($).Distinct('$.Value').Count() == 5")
.Where("$.baker != 5")
.Where("$.cooper != 1")
.Where("$.fletcher != 1 && $.fletcher != 5")
Expand Down

0 comments on commit 53b1016

Please sign in to comment.