minimatch 0.2.14 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/minimatch.js +10 -4
- package/package.json +1 -1
- package/test/defaults.js +1 -1
package/README.md
CHANGED
|
@@ -157,8 +157,8 @@ Perform a case-insensitive match.
|
|
|
157
157
|
### nonull
|
|
158
158
|
|
|
159
159
|
When a match is not found by `minimatch.match`, return a list containing
|
|
160
|
-
the pattern itself. When set, an empty list
|
|
161
|
-
no matches.
|
|
160
|
+
the pattern itself if this option is set. When not set, an empty list
|
|
161
|
+
is returned if there are no matches.
|
|
162
162
|
|
|
163
163
|
### matchBase
|
|
164
164
|
|
package/minimatch.js
CHANGED
|
@@ -813,11 +813,12 @@ function makeRe () {
|
|
|
813
813
|
}
|
|
814
814
|
|
|
815
815
|
minimatch.match = function (list, pattern, options) {
|
|
816
|
+
options = options || {}
|
|
816
817
|
var mm = new Minimatch(pattern, options)
|
|
817
818
|
list = list.filter(function (f) {
|
|
818
819
|
return mm.match(f)
|
|
819
820
|
})
|
|
820
|
-
if (options.nonull && !list.length) {
|
|
821
|
+
if (mm.options.nonull && !list.length) {
|
|
821
822
|
list.push(pattern)
|
|
822
823
|
}
|
|
823
824
|
return list
|
|
@@ -853,12 +854,17 @@ function match (f, partial) {
|
|
|
853
854
|
var set = this.set
|
|
854
855
|
this.debug(this.pattern, "set", set)
|
|
855
856
|
|
|
856
|
-
|
|
857
|
+
// Find the basename of the path by looking for the last non-empty segment
|
|
858
|
+
var filename;
|
|
859
|
+
for (var i = f.length - 1; i >= 0; i--) {
|
|
860
|
+
filename = f[i]
|
|
861
|
+
if (filename) break
|
|
862
|
+
}
|
|
857
863
|
|
|
858
864
|
for (var i = 0, l = set.length; i < l; i ++) {
|
|
859
865
|
var pattern = set[i], file = f
|
|
860
866
|
if (options.matchBase && pattern.length === 1) {
|
|
861
|
-
file =
|
|
867
|
+
file = [filename]
|
|
862
868
|
}
|
|
863
869
|
var hit = this.matchOne(file, pattern, partial)
|
|
864
870
|
if (hit) {
|
|
@@ -975,7 +981,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
|
|
|
975
981
|
}
|
|
976
982
|
// no match was found.
|
|
977
983
|
// However, in partial mode, we can't say this is necessarily over.
|
|
978
|
-
// If there's more *pattern* left, then
|
|
984
|
+
// If there's more *pattern* left, then
|
|
979
985
|
if (partial) {
|
|
980
986
|
// ran out of file
|
|
981
987
|
this.debug("\n>>> no match, partial?", file, fr, pattern, pr)
|
package/package.json
CHANGED