{"id":15546458,"url":"https://github.com/khusnetdinov/linq","last_synced_at":"2025-09-06T03:43:18.536Z","repository":{"id":33280706,"uuid":"36925374","full_name":"khusnetdinov/linq","owner":"khusnetdinov","description":"This gem is wrapper for linq.js JavaScript plugin. Language-Integrated Query (LINQ) is a set of features introduced in Visual Studio 2008 (That moment for #C, VisualBasic) that extends powerful query capabilities to the language syntax. LINQ introduces standard, easily-learned patterns for querying and updating data, and the technology can be extended to support potentially any kind of data store.","archived":false,"fork":false,"pushed_at":"2015-06-08T09:45:28.000Z","size":192,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-25T00:24:45.661Z","etag":null,"topics":["javascript","jquery","linq","linq-javascript-plugin","ruby-gem","wrapper"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khusnetdinov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-05T09:52:48.000Z","updated_at":"2023-10-20T07:33:11.000Z","dependencies_parsed_at":"2022-08-17T18:40:13.969Z","dependency_job_id":null,"html_url":"https://github.com/khusnetdinov/linq","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/khusnetdinov/linq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khusnetdinov%2Flinq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khusnetdinov%2Flinq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khusnetdinov%2Flinq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khusnetdinov%2Flinq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khusnetdinov","download_url":"https://codeload.github.com/khusnetdinov/linq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khusnetdinov%2Flinq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273854462,"owners_count":25180008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","jquery","linq","linq-javascript-plugin","ruby-gem","wrapper"],"created_at":"2024-10-02T13:02:07.690Z","updated_at":"2025-09-06T03:43:18.514Z","avatar_url":"https://github.com/khusnetdinov.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linq\n\nThis gem is wrapper for linq.js JavaScript plugin. Language-Integrated Query (LINQ) is a set of features introduced in Visual Studio 2008 (That moment for #C, VisualBasic) that extends powerful query capabilities to the language syntax. LINQ introduces standard, easily-learned patterns for querying and updating data, and the technology can be extended to support potentially any kind of data store.\n\n## Features\n\n- Implement all .NET 4.0 methods and many extra methods (inspiration from Rx, Achiral, Haskell, Ruby, etc...)\n- Complete lazy evaluation\n- Two versions - linq.js and jquery.linq.js (jQuery plugin)\n- Binding for Reactive Extensions for JavaScript(RxJS)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'linq'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install linq\n\nAdd to javascript manifest `application.js`\n    \n\t//= require linq\n\n## Examples of usage\n```javascript\nvar jsonArray = [\n    { \"user\": { \"id\": 100, \"screen_name\": \"d_linq\" }, \"text\": \"to objects\" },\n    { \"user\": { \"id\": 130, \"screen_name\": \"c_bill\" }, \"text\": \"g\" },\n    { \"user\": { \"id\": 155, \"screen_name\": \"b_mskk\" }, \"text\": \"kabushiki kaisha\" },\n    { \"user\": { \"id\": 301, \"screen_name\": \"a_xbox\" }, \"text\": \"halo reach\" }\n]\n\nvar queryResult = Enumerable.From(jsonArray)\n    .Where(function (x) { return x.user.id \u003c 200 })\n    .OrderBy(function (x) { return x.user.screen_name })\n    .Select(function (x) { return x.user.screen_name + ':' + x.text })\n    .ToArray();\n    \n// shortcut! string lambda selector\nvar queryResult2 = Enumerable.From(jsonArray)\n    .Where(\"$.user.id \u003c 200\")\n    .OrderBy(\"$.user.screen_name\")\n    .Select(\"$.user.screen_name + ':' + $.text\")\n    .ToArray();\n```    \n\nMore tricky:\n\n```javascript\t  \n// anonymous function\nEnumerable.Range(1, 10)\n    .Where(function(i) { return i % 3 == 0; })\n    .Select(function(i) { return i * 10; });\n    \n// lambda expression\nEnumerable.Range(1, 10).Where(\"i =\u003e i % 3 == 0\").Select(\"i =\u003e i * 10\");\n\n// $ is default iterator variable like Scala's \"_\" or Groovy's \"it\"\nEnumerable.Range(1, 10).Where(\"$ % 3 == 0\").Select(\"$ * 10\");\n\n // \"\" is shorthand of \"x =\u003e x\" (identity function)\nEnumerable.Range(4, 7).Join(Enumerable.Range(8, 5), \"\", \"\", \"outer,inner=\u003eouter*inner\");\n\n// Enumerable.From is wrap from primitive array, string(to charArray), object(to KeyValuePair[]) etc..\nvar array = [100, 200, 30, 40, 500, 40, 200];\nvar ex1 = Enumerable.From(array).Distinct().ToArray(); // [100, 200, 30, 40, 500]\nvar ex2 = Enumerable.From(\"foobar\").ToArray(); // [\"f\", \"o\", \"o\", \"b\", \"a\", \"r\"];\nvar ex3 = Enumerable.From({foo:10, bar:20}).ToArray(); // [{Key:\"foo\",Value:10}, {Key:\"bar\",Value:20}]\n\n// object literal\nEnumerable.From(array).Select(\"val,i=\u003e{Value:val, Index:i}\")\n```\nAnd Jquery:\n\n```javascript\n// $.Enumerable\n$.Enumerable.Range(1, 10).Where(\"$ % 2 == 0\").ForEach(\"alert($)\");\n\n// TojQuery - Enumerable to jQuery\n$.Enumerable.Range(1, 10)\n    .Select(function (i) { return $(\"\u003coption\u003e\").text(i)[0] })\n    .TojQuery()\n    .appendTo(\"#select1\");\n\n// toEnumerable - jQuery to Enumerable\nvar sum = $(\"#select1\").children()\n    .toEnumerable()\n    .Select(\"parseInt($.text())\")\n    .Sum(); // 55\n```\n\n\nFull [documentation is on the wiki][wiki]\n\n[wiki]: https://github.com/khusnetdinov/linq/wiki\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhusnetdinov%2Flinq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhusnetdinov%2Flinq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhusnetdinov%2Flinq/lists"}