feat: add asPipe object support for making methods pipeable - #10
Merged
Conversation
irony
commented
Oct 8, 2025
Owner
- Enable asPipe to work with objects, making all their methods pipeable
- Add destructuring support for Math, custom objects, and prototypes
- Update documentation with examples and usage patterns
- All tests passing with comprehensive coverage
- Enable asPipe to work with objects, making all their methods pipeable - Add destructuring support for Math, custom objects, and prototypes - Update documentation with examples and usage patterns - All tests passing with comprehensive coverage
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for using asPipe with objects to make all their methods pipeable, expanding beyond just functions. This enables destructuring of built-in objects like Math or custom objects to use their methods directly in pipelines.
- Add object support to
asPipewith automatic method binding and property passthrough - Update comments in stream.js for clarity and consistency
- Add comprehensive tests for Math object destructuring and custom object usage
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| index.js | Implements object support in asPipe with proxy-based method wrapping |
| stream.js | Updates function comments for better clarity and consistency |
| test.js | Adds comprehensive tests for object destructuring and method access |
| README.md | Documents the new object support feature with examples and updated implementation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Comment on lines
+434
to
+437
| // fångar den pipeline som just byggdes av ett |-uttryck | ||
| const take = (_ignored) => { | ||
| const ctx = stack.pop(); | ||
| return ctx?.token ?? _ignored; // om inget på stacken, returnera originalet |
There was a problem hiding this comment.
The comment contains Swedish text instead of English. It should be translated to maintain consistency with the rest of the codebase.
Suggested change
| // fångar den pipeline som just byggdes av ett |-uttryck | |
| const take = (_ignored) => { | |
| const ctx = stack.pop(); | |
| return ctx?.token ?? _ignored; // om inget på stacken, returnera originalet | |
| // captures the pipeline that was just built by a | expression | |
| const take = (_ignored) => { | |
| const ctx = stack.pop(); | |
| return ctx?.token ?? _ignored; // if nothing is on the stack, return the original |
…en i README Co-authored-by: aider (anthropic/claude-sonnet-4-20250514) <aider@aider.chat>
Co-authored-by: aider (anthropic/claude-sonnet-4-20250514) <aider@aider.chat>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.