{"id":17736641,"url":"https://github.com/parro-it/ai-filter","last_synced_at":"2025-03-31T19:17:11.688Z","repository":{"id":57174763,"uuid":"111146743","full_name":"parro-it/ai-filter","owner":"parro-it","description":"Filter over async iterables.","archived":false,"fork":false,"pushed_at":"2017-11-29T16:02:13.000Z","size":526,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T16:58:30.005Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/parro-it.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":"2017-11-17T20:18:01.000Z","updated_at":"2019-07-09T11:56:07.000Z","dependencies_parsed_at":"2022-08-29T00:11:08.060Z","dependency_job_id":null,"html_url":"https://github.com/parro-it/ai-filter","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fai-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fai-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fai-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fai-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parro-it","download_url":"https://codeload.github.com/parro-it/ai-filter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246523847,"owners_count":20791444,"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":[],"created_at":"2024-10-26T00:23:53.168Z","updated_at":"2025-03-31T19:17:11.657Z","avatar_url":"https://github.com/parro-it.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ai-filter\n\n[![Travis Build Status](https://img.shields.io/travis/parro-it/ai-filter/master.svg)](http://travis-ci.org/parro-it/ai-filter)\n[![NPM downloads](https://img.shields.io/npm/dt/ai-filter.svg)](https://npmjs.org/package/ai-filter)\n\n\u003e Filter over async iterables.\n\nThis method creates a new async iterable with all elements that pass the test\nimplemented by the provided function.\n\n## Async iterable fun\n\n**This module is part of\n[Async iterable fun](https://github.com/parro-it/ai-fun), a complete toolset of\nmodules to work with async iterables.**\n\n## Usage\n\nThis example read a text file, filtering only chunks containing a new line:\n\n```js\nimport filter from 'ai-filter';\nimport { createReadStream } from \"fs\";\n\nconst stream = createReadStream(`file.txt`, \"utf8\");\nconst result = filter(chunk =\u003e chunk.contains('\\n'), fromStream(stream))\nfor await (const chunk of result) {\n  console.log(chunk);\n}\n```\n\n## API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### index\n\nThe filter() method creates a new async iterable with all elements that pass the\ntest implemented by the provided function.\n\n**Parameters**\n\n* `predicate`\n  **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**\n  is a predicate, to test each element of the async iterable. Return true to\n  keep the element, false otherwise, taking three arguments: \n\n```\n        element: The current element being processed in the async iterable.\n        index: The index of the current element being processed in the async iterable.\n        iterable: The async iterable filter was called upon.\n```\n\n* `data` **AsyncIterable** The source async iterable to filter.\n\nReturns **AsyncIterable** A new async iterable with the elements that pass the\ntest.\n\n## Install\n\nWith [npm](https://npmjs.org/) installed, run\n\n```bash\nnpm install --save ai-filter\n```\n\n## See Also\n\n* [`noffle/common-readme`](https://github.com/noffle/common-readme)\n* [`parro-it/ai-fun`](https://github.com/parro-it/ai-fun)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Fai-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparro-it%2Fai-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Fai-filter/lists"}