Skip to content

feat: Restrict allowed uniqueBy string options - #173

Merged
phated merged 2 commits into
mainfrom
phated/restrict-uniqueby
Nov 19, 2026
Merged

phated merged 2 commits into
mainfrom
phated/restrict-uniqueby

Conversation

@phated

@phated phated commented Nov 19, 2026

Copy link
Copy Markdown
Member

This restricts the set of strings that can be specified for uniqueBy when providing a string instead of a function. There are only 3 properties on the object glob-stream produces so these are the only properties that make sense to allow.

@phated
phated requested a review from FotoVerite November 19, 2026 19:12
@phated phated self-assigned this Nov 19, 2026
@phated phated added this to v6 Nov 19, 2026
@github-project-automation github-project-automation Bot moved this to Todo in v6 Nov 19, 2026
@phated phated moved this from Todo to In Progress in v6 Nov 19, 2026
Base automatically changed from phated/esm to main November 19, 2026 20:39
@phated
phated force-pushed the phated/restrict-uniqueby branch from 56e32d3 to d626d82 Compare November 19, 2026 20:40
@phated
phated merged commit 211fbfa into main Nov 19, 2026
5 checks passed
@phated
phated deleted the phated/restrict-uniqueby branch November 19, 2026 21:10
@github-project-automation github-project-automation Bot moved this from In Progress to Done in v6 Nov 19, 2026
Comment thread index.js
}

if (typeof uniqueBy === "string") {
if (uniqueBy === "cwd" || uniqueBy === "base" || uniqueBy === "path") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I get to three or more I usually go for ["cwd", "base", "path"].includes(uniqueBy)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line didn't wrap so I figured this was easy enough to reason about. If the keys would have been longer, I think I would have done it with includes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants