aboutsummaryrefslogtreecommitdiff
path: root/node_modules/anymatch
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-08-14 05:01:11 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-08-14 05:02:09 +0200
commit363723fc84f7b8477592e0105aeb331ec9a017af (patch)
tree29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/anymatch
parent5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff)
downloadwallet-core-363723fc84f7b8477592e0105aeb331ec9a017af.tar.xz
node_modules
Diffstat (limited to 'node_modules/anymatch')
-rw-r--r--node_modules/anymatch/README.md9
-rw-r--r--node_modules/anymatch/index.js15
-rw-r--r--node_modules/anymatch/package.json6
3 files changed, 20 insertions, 10 deletions
diff --git a/node_modules/anymatch/README.md b/node_modules/anymatch/README.md
index 0a6329213..62f65da87 100644
--- a/node_modules/anymatch/README.md
+++ b/node_modules/anymatch/README.md
@@ -38,7 +38,7 @@ var anymatch = require('anymatch');
var matchers = [
'path/to/file.js',
'path/anyjs/**/*.js',
- /foo.js$/,
+ /foo\.js$/,
function (string) {
return string.indexOf('bar') !== -1 && string.length > 10
}
@@ -58,6 +58,13 @@ anymatch(matchers, 'path/anyjs/foo.js', true); // 1
anymatch(matchers, 'path/to/file.js', false, 1); // false
anymatch(matchers, 'path/anyjs/foo.js', true, 2, 3); // 2
anymatch(matchers, 'path/to/bar.js', true, 0, 3); // -1
+
+// using globs to match directories and their children
+anymatch('node_modules', 'node_modules'); // true
+anymatch('node_modules', 'node_modules/somelib/index.js'); // false
+anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true
+anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false
+anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true
```
#### anymatch (matchers)
diff --git a/node_modules/anymatch/index.js b/node_modules/anymatch/index.js
index fd70ba07e..e41161850 100644
--- a/node_modules/anymatch/index.js
+++ b/node_modules/anymatch/index.js
@@ -1,8 +1,9 @@
'use strict';
-var arrify = require('arrify');
var micromatch = require('micromatch');
-var path = require('path');
+var normalize = require('normalize-path');
+var path = require('path'); // required for tests.
+var arrify = function(a) { return a == null ? [] : (Array.isArray(a) ? a : [a]); };
var anymatch = function(criteria, value, returnIndex, startIndex, endIndex) {
criteria = arrify(criteria);
@@ -15,12 +16,12 @@ var anymatch = function(criteria, value, returnIndex, startIndex, endIndex) {
}
startIndex = startIndex || 0;
var string = value[0];
- var altString;
+ var altString, altValue;
var matched = false;
var matchIndex = -1;
- function testCriteria (criterion, index) {
+ function testCriteria(criterion, index) {
var result;
- switch (toString.call(criterion)) {
+ switch (Object.prototype.toString.call(criterion)) {
case '[object String]':
result = string === criterion || altString && altString === criterion;
result = result || micromatch.isMatch(string, criterion);
@@ -30,6 +31,7 @@ var anymatch = function(criteria, value, returnIndex, startIndex, endIndex) {
break;
case '[object Function]':
result = criterion.apply(null, value);
+ result = result || altValue && criterion.apply(null, altValue);
break;
default:
result = false;
@@ -53,8 +55,9 @@ var anymatch = function(criteria, value, returnIndex, startIndex, endIndex) {
}, []);
if (!negGlobs.length || !micromatch.any(string, negGlobs)) {
if (path.sep === '\\' && typeof string === 'string') {
- altString = string.split('\\').join('/');
+ altString = normalize(string);
altString = altString === string ? null : altString;
+ if (altString) altValue = [altString].concat(value.slice(1));
}
matched = crit.slice(startIndex, endIndex).some(testCriteria);
}
diff --git a/node_modules/anymatch/package.json b/node_modules/anymatch/package.json
index 2f64160f2..c575a09b2 100644
--- a/node_modules/anymatch/package.json
+++ b/node_modules/anymatch/package.json
@@ -1,6 +1,6 @@
{
"name": "anymatch",
- "version": "1.3.0",
+ "version": "1.3.2",
"description": "Matches strings against configurable strings, globs, regular expressions, and/or functions",
"files": [
"index.js"
@@ -36,8 +36,8 @@
"test": "istanbul cover _mocha && cat ./coverage/lcov.info | coveralls"
},
"dependencies": {
- "arrify": "^1.0.0",
- "micromatch": "^2.1.5"
+ "micromatch": "^2.1.5",
+ "normalize-path": "^2.0.0"
},
"devDependencies": {
"coveralls": "^2.11.2",