{"id":21461455,"url":"https://github.com/berhalak/fromit","last_synced_at":"2025-08-01T10:39:26.755Z","repository":{"id":42638474,"uuid":"241213671","full_name":"berhalak/fromit","owner":"berhalak","description":"Linq for js Iterables","archived":false,"fork":false,"pushed_at":"2023-01-12T20:06:33.000Z","size":273,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-06T06:51:24.675Z","etag":null,"topics":["iterables","linq"],"latest_commit_sha":null,"homepage":"","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/berhalak.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":"2020-02-17T21:40:51.000Z","updated_at":"2022-01-03T10:46:58.000Z","dependencies_parsed_at":"2023-02-09T13:16:28.524Z","dependency_job_id":null,"html_url":"https://github.com/berhalak/fromit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"berhalak/ts-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berhalak%2Ffromit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berhalak%2Ffromit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berhalak%2Ffromit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berhalak%2Ffromit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berhalak","download_url":"https://codeload.github.com/berhalak/fromit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243976503,"owners_count":20377692,"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":["iterables","linq"],"created_at":"2024-11-23T07:09:15.196Z","updated_at":"2025-03-17T04:49:13.974Z","avatar_url":"https://github.com/berhalak.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/berhalak/linq)\n\n# fromit\n\nLinq style (like in c#) using generators\n\n```sh\nnpm install fromit\n```\n\nOr use directly\n\n```html\n\u003cscript src=\"https://unpkg.com/fromit/dist/fromit.min.js\"\u003e\u003c/script\u003e\n```\n\n```ts\nimport { from } from \"fromit\";\n\nconst list = new Set([1, 2, 3]);\nexpect(\n  from(list)\n    .filter(x =\u003e x \u003e 2)\n    .first()\n).toBe(3);\n\nconst a = [1, 2, 3];\nconst b = [3, 4, 5];\nlet r = from(a).intersect(b);\nexpect(r.count()).toBe(1);\n\n// speed up array functions\n\nconst slow = [...from(1000)].map(x=\u003e x + 1).find(x=\u003e x == 4);\nconst fast = from(1000).map(x=\u003e x + 1).find(x =\u003e x == 4);\n\n// used with async await\n\nasync function* generator() {\n  yield 1;\n  yield 2;\n  yield 3;\n}\n\nasync function promise(): Promise\u003cnumber[]\u003e {\n  return [1, 2, 3];\n}\n\nconst result1 = from(generator());\nconst result2 = from(promise());\n\nexpect(await result1.toArray()).toStrictEqual(await result2.toArray());\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberhalak%2Ffromit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberhalak%2Ffromit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberhalak%2Ffromit/lists"}