micromatch / micromatch/picomatch

Using format option for picomatch.test to match against non-string inputs

Open
#151 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.3k
Forks
135
Avg merge
23h 38m
Merged PRs (30d)
7

Description

Hi, I was trying to use micromatch with the format option to match against a property of an object I was passing. However, I quickly hit a snag due to the first conditional at the top of picomatch.test -

https://github.com/micromatch/picomatch/blob/master/lib/picomatch.js#L116

Is it possible to move that further down in the function, after format (if specified) is applied? The use case seems pretty sane - pass an array of objects to micromatch() with a custom format callback which just grabs a property from the object, and the returned matches are the original objects.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/picomatch.js at the picomatch.test conditional around line 116 and inspect how the format option is applied. Verify the behavior with objects passed through micromatch and a format callback that selects a property; done means matching accepts non-string inputs while returning the original objects.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.