{"id":13526633,"url":"https://github.com/floatdrop/stream-assert","last_synced_at":"2025-03-15T13:30:51.833Z","repository":{"id":19630959,"uuid":"22882892","full_name":"floatdrop/stream-assert","owner":"floatdrop","description":"Assertion library for streams","archived":false,"fork":false,"pushed_at":"2015-07-29T07:45:48.000Z","size":341,"stargazers_count":18,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-14T01:31:43.572Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/floatdrop.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":"2014-08-12T15:40:36.000Z","updated_at":"2021-08-19T08:52:26.000Z","dependencies_parsed_at":"2022-08-21T13:40:28.040Z","dependency_job_id":null,"html_url":"https://github.com/floatdrop/stream-assert","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fstream-assert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fstream-assert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fstream-assert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fstream-assert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floatdrop","download_url":"https://codeload.github.com/floatdrop/stream-assert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243507736,"owners_count":20301885,"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-08-01T06:01:32.426Z","updated_at":"2025-03-15T13:30:51.427Z","avatar_url":"https://github.com/floatdrop.png","language":"JavaScript","readme":"# stream-assert\n[![Build Status][travis-image]][travis-url]\n\nAssert streams with ease.\n\n## Usage\n\n```js\nvar intoStream = require('into-stream');\nvar assert = require('stream-assert');\nvar is = require('funsert');\n\nintoStream([1, 2, 3])\n    .pipe(assert.first(is.equal(1)))\n    .pipe(assert.second(is.equal(2)))\n    .pipe(assert.nth(2, is.equal(3)))\n    .pipe(assert.length(1))\n    .pipe(assert.end(console.log));\n```\n\n## Chaining\n\nAssertions are chained through passing `assertion` from pipe to pipe. If you want inject assertions in the middle of pipeline, you can attach `on('assertion')` handler to manualy catch assertions (instead of placing `assert.end`).\n\n\n## API\n\n### stream-assert\n\nBuilder for asserting stream.\n\n#### nth(n, assertion)\n\nCalls `assertion` function on `nth` element in stream.\n\n#### first(assertion)\n\u003e alias to nth(0, obj)\n\n#### second(assertion)\n\u003e alias to nth(1, obj)\n\n#### last(assertion)\n\nCalls `assertion` function on the last element in stream.\n\n#### length(len)\n\nAsserting, that length of stream is equal `len` at the end of the stream.\n\n#### all(assertion)\n\nChecking that all elements in stream pass assertion function.\n\n#### any(assertion)\n\nChecking that at least one of elements in stream pass assertion function.\n\n#### end([cb])\n\nSince streams has internal [buffer and highWatermark](http://nodejs.org/api/stream.html#stream_buffering),\nthat stops data flow, when reached — test stream needs a dumping point, that will flush that buffer.\n\n`assert.end` will dump all data to `/dev/null` — so all pipes after this point will not get any data.\n\n### assert.defaults\nType: `Object`  \n\nContains defaults, that will be passed to `through` constructor.\n\n * `highWatermark` — by default, will be equal `16`. If you don't want to use `assert.end`, then you can increase it.\n\n## License\n\nMIT (c) 2014 Vsevolod Strukchinsky\n\n[travis-url]: http://travis-ci.org/floatdrop/stream-assert\n[travis-image]: http://img.shields.io/travis/floatdrop/stream-assert.svg?branch=master\u0026style=flat\n","funding_links":[],"categories":["Repository","JavaScript","Modules"],"sub_categories":["Streams"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatdrop%2Fstream-assert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloatdrop%2Fstream-assert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatdrop%2Fstream-assert/lists"}