npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

wildkarte

v1.1.0

Published

This is a library to expand wildcards.

Downloads

5

Readme

wildkarte

wildkarteはワイルドカードを展開するためのライブラリです。

wildcardだとすでに別のモジュールが存在するようでしたので、cardをドイツ語に変えてみました。ドイツ語にした理由は「何となく格好いいから」以外にはありません。

NPM version NPM monthly download NPM total download Build Status MIT License

使い方

import * as wildkarte from 'wildkarte';

const traverser = wildkarte.expand('**\/*.js');
for await (const path of traverser(cwd)) {
  console.log(path);
}

const re = wildkarte.toRegExp('*.ts');

wildkarte.expand

引数startに指定されたディレクトリから、パターンにマッチするすべてのファイル/ディレクトリを、startからの相対パスで返す、非同期ジェネレーターを返します。

export function expand(pattern: string, options?: {ignoreCase?: boolean, ignoreFiles?: IgnoreCallback}): (start: string) => AysncGenerator<string, void>;

引数

pattern: string 検索するファイル/ディレクトリ名のパターン。パスのセパレーターはOSにかかわらず/を使用してください。

  • **はそれ以下のすべてのパス
  • ?はファイル/ディレクトリの名前に使用されるすべての1文字
  • *はファイル/ディレクトリの名前に使用されるすべての0個以上の文字
  • {AAA,BBB}AAABBBのいずれか。
    AAABBBの部分は
    • *?のワイルドカードを含めることができます。
    • {xxx,yyy{AAA,BBB}}のようにネストできます。
    • /を含めることはできません。
  • <~><>で囲まれた間の文字をワイルドカードとしてではなく、その文字として扱います。ただし、/を含めることはできません。

options: object 検索に関するオプション。ignoreCaseignoreFilesが指定できます。

  • ignoreCase: boolean 検索時のファイル名で大文字小文字を区別する場合には真を指定します。

ただし、**やワイルドカードが指定されている場所でのみ有効で、ファイル名やディレクトリ名が完全に指定されている箇所についてはファイルシステムの扱いに依存します。

省略時にはprocess.platformwin32cygwinであれば真を、その他の場合には偽を指定したものとします。

  • ignoreFiles: ({path: string, stat: fs.Stat}) => boolean そのファイル、ディレクトリを無視するかどうかを決定する関数。

この関数がtrueを返したとき、そのファイル、もしくはそのディレクトリ以下のすべてのファイル、ディレクトリはpatternにマッチしてもスキップされます。

省略時はすべてのファイル・ディレクトリをスキップしません。

ただし、この関数で無視するかどうかを指定できるのは**やワイルドカードが指定されている場所でのみ有効で、ファイル名やディレクトリ名が完全に指定されている箇所については無視されません。

  • fileOnly: boolean ファイルだけにマッチさせる場合には真を指定します。

たとえば、**/*.jsというパターンにはnode_modules/vue.js/というディレクトリもマッチしてしまいますが、ファイルにだけマッチさせたい場合に真を指定します。

逆にディレクトリだけにマッチさせたい場合には**/*.js/のように末尾に/を追加してください。

返値

引数startに指定されたディレクトリから、パターンにマッチするすべてのファイル/ディレクトリを、startからの相対パスで返す、非同期ジェネレーターを返します。

wildkarte.toRegExp

ワイルドカードを正規表現に変換します。

引数

pattern: string 検索するファイル/ディレクトリ名のパターン。

  • * 0文字以上の/以外のすべての文字にマッチします。
  • ? 1文字の/以外のすべての文字にマッチします。
  • {パターン1,パターン2} 複数のパターンにマッチします。
    ネストも可です。
    /は含められません。
  • <文字列> ワイルドカードでの特殊文字を含んだファイル名にマッチさせるとき使用します。 <{*}?,>のように複数で指定可能ですが、>だけは<>>のように単独で指定します。 /は含められません。

options: object ワイルドカードを正規表現に変換するときのオプション。それぞれ省略可です。

  • start ワイルドカードを開始したインデックス。 変換時にエラーが発生したときのインデックス計算に使用します。 省略時には0が指定されたものとします。
  • ignoreCase ファイル名の大文字小文字を無視する場合に真を指定します。 省略時にはprocess.platformが'win32'か'cygwin'であれば真、それ以外では偽が指定されたものとします。

返値

指定したワイルドカード文字列を正規表現に変換したものを返します。