Skip to content

Conversation

@iliagon
Copy link

@iliagon iliagon commented Nov 21, 2025

Summary

This PR adds support for sorting by key directly on the Sequence and AsyncSequence types, similar to PR winterbe#33 from the original sequency repository.

Changes

  • Added key parameter support to sortedBy and sortedByDescending methods for both sync and async sequences
  • Methods now accept either a selector function or a key string: .sortedBy("a") or .sortedBy(it => it.a)

Example Usage

// Using key string
sequenceOf({a: 4}, {a: 1}, {a: 3})
    .sortedBy("a")  // ✅ Now works!
    .sortedByDescending("a")  // ✅ Now works!

// Using selector function (still works)
sequenceOf({a: 4}, {a: 1}, {a: 3})
    .sortedBy(it => it.a)
    .sortedByDescending(it => it.a)

Based on PR #33 from the original sequency repository.

@iliagon iliagon merged commit 6ff19cb into master Nov 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants