Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

settings: Add uniqueBy function #374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

phated
Copy link

@phated phated commented Oct 18, 2022

What is the purpose of this pull request?

I've been investigating fast-glob for usage in gulp via glob-stream and I noticed you had a unique setting, but not a way to configure the uniqueness value. We provide a uniqueBy configuration that we passed into a unique-stream to deduplicate values. However, if fast-glob provides that functionality, we can drop unique-stream and pumpify dependencies which would be a huge performance win!

What changes did you make? (Give an overview)

I added a uniqueBy option that is used to pluck the property to use for duplicate entries. This defaults to plucking entry.path by default.

@@ -3,7 +3,7 @@ import { Entry, EntryFilterFunction, MicromatchOptions, Pattern, PatternRe } fro
import * as utils from '../../utils';

export default class EntryFilter {
public readonly index: Map<string, undefined> = new Map();
public readonly index: Map<unknown, undefined> = new Map();
Copy link
Author

Choose a reason for hiding this comment

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

I'm also curious if we could have a shared/cached index in case we want to create multiple separate fast-glob instances (such as would be needed to support ordered glob negation)

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.

None yet

1 participant