{"id":19119333,"url":"https://github.com/thebeachmaster/samples","last_synced_at":"2025-07-09T11:04:06.668Z","repository":{"id":85933753,"uuid":"97573360","full_name":"TheBeachMaster/samples","owner":"TheBeachMaster","description":null,"archived":false,"fork":false,"pushed_at":"2017-12-29T14:31:45.000Z","size":1928,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-11T16:37:36.031Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","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/TheBeachMaster.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-18T08:24:50.000Z","updated_at":"2017-07-18T08:58:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7522ce5-f7e8-4a81-a80c-14c58f683f7e","html_url":"https://github.com/TheBeachMaster/samples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TheBeachMaster/samples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBeachMaster%2Fsamples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBeachMaster%2Fsamples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBeachMaster%2Fsamples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBeachMaster%2Fsamples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheBeachMaster","download_url":"https://codeload.github.com/TheBeachMaster/samples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBeachMaster%2Fsamples/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259364755,"owners_count":22846546,"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-11-09T05:09:16.119Z","updated_at":"2025-07-09T11:04:06.660Z","avatar_url":"https://github.com/TheBeachMaster.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"through2-filter\r\n===============\r\n\r\n[![NPM](https://nodei.co/npm/through2-filter.png)](https://nodei.co/npm/through2-filter/)\r\n\r\nThis is a super thin wrapper around [through2](http://npm.im/through2) that works like `Array.prototype.filter` but for streams.\r\n\r\nFor when through2 is just too verbose :wink:\r\n\r\nNote you will **NOT** be able to alter the content of the chunks. This is intended for filtering only. If you want to modify the stream content, use either `through2` or `through2-map`.\r\n\r\n```js\r\nvar filter = require(\"through2-filter\")\r\n\r\nvar skip = filter(function (chunk) {\r\n  // skip buffers longer than 100\r\n  return chunk.length \u003c 100\r\n})\r\n\r\n// vs. with through2:\r\nvar skip = through2(function (chunk, encoding, callback) {\r\n  // skip buffers longer than 100\r\n  if (chunk.length \u003c 100) this.push(chunk)\r\n  return callback()\r\n})\r\n\r\n// Then use your filter:\r\nsource.pipe(skip).pipe(sink)\r\n\r\n// Additionally accepts `wantStrings` argument to conver buffers into strings\r\nvar alphanum = new RegExp(\"^[A-Za-z0-1]+$\")\r\nvar scrub = filter({wantStrings: true}, function (str) {\r\n  return alphanum.exec(str)\r\n})\r\n\r\n// Works like `Array.prototype.filter` meaning you can specify a function that\r\n// takes up to two* arguments: fn(element, index)\r\nvar skip10 = filter(function (element, index) {\r\n  return index \u003e 10\r\n})\r\n```\r\n\r\n*Differences from `Array.prototype.filter`:\r\n  * No third `array` callback argument. That would require realizing the entire stream, which is generally counter-productive to stream operations.\r\n  * `Array.prototype.filter` doesn't modify the source Array, which is somewhat nonsensical when applied to streams.\r\n\r\nAPI\r\n---\r\n\r\n`require(\"through2-filter\")([options], fn)`\r\n---\r\n\r\nCreate a `through2-filter` instance that will call `fn(chunk)`. If `fn(chunk)` returns \"true\" the chunk will be passed downstream. Otherwise it will be dropped.\r\n\r\n`require(\"through2-filter\").ctor([options], fn)`\r\n---\r\n\r\nCreate a `through2-filter` Type that can be instantiated via `new Type()` or `Type()` to create reusable spies.\r\n\r\n`require(\"through2-filter\").obj([options], fn)`\r\n---\r\n\r\nCreate a `through2-filter` that defaults to `objectMode = true`.\r\n\r\n`require(\"through2-filter\").objCtor([options], fn)`\r\n---\r\n\r\nCreate a `through2-filter` Type that defaults to `objectMode = true`.\r\n\r\nOptions\r\n-------\r\n\r\n  * wantStrings: Automatically call chunk.toString() for the super lazy.\r\n  * all other through2 options\r\n\r\nLICENSE\r\n=======\r\n\r\nMIT\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebeachmaster%2Fsamples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthebeachmaster%2Fsamples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebeachmaster%2Fsamples/lists"}