From fada5109ae9a13c8e63ee6e794a74ab3d14a33b6 Mon Sep 17 00:00:00 2001 From: mag123c Date: Mon, 14 Jul 2025 09:55:20 +0900 Subject: [PATCH] path: add exclude option to matchesGlob method Add support for exclude patterns in path.matchesGlob() to provide consistency with fs.glob(). The exclude option accepts strings, arrays, or functions to filter out matching paths. Fixes: https://github.com/nodejs/node/issues/59015 --- doc/api/path.md | 30 +++++++++++++++-- lib/internal/fs/glob.js | 58 +++++++++++++++++++++++++++++---- lib/path.js | 12 +++++-- test/parallel/test-path-glob.js | 38 +++++++++++++++++++++ 4 files changed, 128 insertions(+), 10 deletions(-) diff --git a/doc/api/path.md b/doc/api/path.md index 2c8398c877572d..bb95825f3e867d 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -283,7 +283,7 @@ path.format({ // Returns: 'C:\\path\\dir\\file.txt' ``` -## `path.matchesGlob(path, pattern)` +## `path.matchesGlob(path, pattern[, options])`