{"id":26107291,"url":"https://github.com/biggyspender/blinq","last_synced_at":"2025-06-14T09:38:35.364Z","repository":{"id":33222944,"uuid":"154010572","full_name":"biggyspender/blinq","owner":"biggyspender","description":"TypeScript implementation of Microsoft dotnet's LINQ to Objects using ES6 iterables","archived":false,"fork":false,"pushed_at":"2022-12-08T19:28:21.000Z","size":1253,"stargazers_count":13,"open_issues_count":21,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-14T04:35:43.855Z","etag":null,"topics":["iterable","iterator","javascript","linq","linq-to-objects","typescript-library"],"latest_commit_sha":null,"homepage":"https://biggyspender.github.io/blinq/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/biggyspender.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-21T13:20:34.000Z","updated_at":"2022-03-26T17:32:59.000Z","dependencies_parsed_at":"2023-01-15T00:00:21.930Z","dependency_job_id":null,"html_url":"https://github.com/biggyspender/blinq","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/biggyspender/blinq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggyspender%2Fblinq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggyspender%2Fblinq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggyspender%2Fblinq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggyspender%2Fblinq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biggyspender","download_url":"https://codeload.github.com/biggyspender/blinq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biggyspender%2Fblinq/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259796304,"owners_count":22912688,"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","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":["iterable","iterator","javascript","linq","linq-to-objects","typescript-library"],"created_at":"2025-03-09T22:53:02.249Z","updated_at":"2025-06-14T09:38:35.338Z","avatar_url":"https://github.com/biggyspender.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## A strongly-typed TypeScript implementation of Microsoft dotnet's LINQ to Objects using ES6 iterables.\n\nWith the advent of javascript iterators and generators, its possible to pipe sequences through a bunch of transformations without materializing collections (arrays) for the intermediate steps. This library attempts to recreate the dotnet linq-to-objects api to provide a number of standard operations on iterable sequences.\n\nThe following operations are available, and the user can optionally supply their own `EqualityComparer` (implementing `equals` and `getHashCode`) when using the set-based operations.\n\n\n\n```aggregate, all, any, append, average, concat, count, defaultIfEmpty, distinctBy, distinct, elementAt, except, firstOrDefault, first, flatten, forEach, fullOuterGroupJoin, fullOuterJoin, groupAdjacent, groupBy, groupJoin, intersect, isSubsetOf, isSupersetOf, join, lastOrDefault, last, leftOuterJoin, maxBy, max, minBy, min, orderBy / orderByDescending / thenBy / thenByDescending, preprend, reverse, selectMany, select, sequenceEqual, singleOrDefault, single, skip, skipWhile, sum, take, takeWhile, toArray, toLookup, toMap, toSet, union, where, zipAll, zip```\n\n[![Build Status](https://travis-ci.org/biggyspender/blinq.svg?branch=master)](https://travis-ci.org/biggyspender/blinq)\n[![Coverage Status](https://coveralls.io/repos/github/biggyspender/blinq/badge.svg?branch=master)](https://coveralls.io/github/biggyspender/blinq?branch=master)\n\nNPM package can be downloaded [here](https://www.npmjs.com/package/blinq).\n\n### documentation\n\nGenerated documentation can be found at [https://biggyspender.github.io/blinq/](https://biggyspender.github.io/blinq/)\n\n### How?\n\nImport blinq ES6 style:\n\n    import {\n      blinq,\n      range,\n      empty,\n      fromGenerator,\n      fromSingleValue,\n      repeatGenerate,\n      repeat,\n      EqualityComparer,\n      hashString\n    } from \"blinq\";\n\nor nodejs style:\n\n    const {\n      blinq,\n      range,\n      empty,\n      fromGenerator,\n      fromSingleValue,\n      repeatGenerate,\n      repeat,\n      EqualityComparer,\n      hashString\n    } = require(\"blinq\")\n\nNow, just wrap your iterable with a call to `blinq(myIterable)`, and start transforming your data:\n\n\n    const someNumbers = [1, 2, 3, 4];\n    const squares = blinq(someNumbers).select(n =\u003e n * n);\n    for(let v of squares){\n        console.log(v);\n    }\n    \n...or if you'd like an array of your results, you can materialize a blinq query with the `.toArray()` method:\n\n    const someNumbers = range(1, 4);\n    const squaresBelowTen = someNumbers.select(n =\u003e n * n).where(n =\u003e n \u003c 10);\n    const arr = squaresBelowTen.toArray();\n    console.log(arr);\n  \nor even spread your results into an array:\n\n    const arr2 = [...squaresBelowTen]\n\n### A case-insensitive set, using EqualityComparer\u003cT\u003e\n\n    const names = [\"zebra\", \"antelope\", \"ardvaark\", \"tortoise\", \"turtle\", \"dog\", \"frog\"]\n    const comparer: EqualityComparer\u003cstring\u003e = {\n        equals: (a, b) =\u003e a.toLowerCase() === b.toLowerCase(),\n        getHashCode: (x) =\u003e hashString(x.toLowerCase())\n    }\n    const set = blinq(names).toSet(comparer)\n    expect(set.has(\"DOg\")).toBeTruthy()\n\n#### More examples:\n\nLet's make a collection of cars:\n\n    const cars = [{\n        manufacturer:\"Ford\",\n        model:\"Escort\"\n      },{\n        manufacturer:\"Ford\",\n        model:\"Cortina\"\n      },{\n        manufacturer:\"Renault\",\n        model:\"Clio\"\n      },{\n        manufacturer:\"Vauxhall\",\n        model:\"Corsa\"\n      },{\n        manufacturer:\"Ford\",\n        model:\"Fiesta\"\n      },{\n        manufacturer:\"Fiat\",\n        model:\"500\"\n      }\n    ];\n    \n...and sort them by manufacturer, and then by model:\n\n    const orderedCars = blinq(cars).orderBy(c =\u003e c.manufacturer).thenBy(c =\u003e c.model);\n    console.log(orderedCars.toArray());\n    \nOr we could count the number of cars for each manufacturer:\n\n    const carsPerManufacturer = blinq(cars)\n      .groupBy(c =\u003e c.manufacturer)\n      .select(g =\u003e ({\n        manufacturer:g.key, \n        count:g.count()\n      }))\n      .orderBy(c =\u003e c.manufacturer);\n    for(var c of carsPerManufacturer){\n      console.log(`${c.manufacturer} : ${c.count}`);\n    }\n\n### What next?\n\nThe [tests](https://github.com/biggyspender/blinq/tree/master/test) for this project are kept up to date and are the best place to look for other examples.\n\n\n### acknowledgements\n\nCreated using the wonderful [https://github.com/alexjoverm/typescript-library-starter](https://github.com/alexjoverm/typescript-library-starter).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiggyspender%2Fblinq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiggyspender%2Fblinq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiggyspender%2Fblinq/lists"}