Comparing version 1.0.0 to 1.0.1
@@ -14,2 +14,12 @@ ## History | ||
### [1.0.1] - 2016-12-12 | ||
**Added** | ||
- Support for windows path edge cases where backslashes are used in brackets or other unusual combinations. | ||
### [1.0.0] - 2016-12-12 | ||
Stable release. | ||
### [0.1.0] - 2016-10-08 | ||
@@ -16,0 +26,0 @@ |
@@ -392,4 +392,8 @@ 'use strict'; | ||
return function(str) { | ||
// don't unixify unless necessary | ||
if (str === pattern) { | ||
return true; | ||
} | ||
var ele = unixify(str); | ||
if (str === pattern || ele === pattern || regex.test(ele)) { | ||
if (ele === pattern || regex.test(ele)) { | ||
return true; | ||
@@ -396,0 +400,0 @@ } |
@@ -27,3 +27,3 @@ 'use strict'; | ||
.set('escape', function(node) { | ||
if (this.options.unescape && /[\w_.-]/.test(node.val)) { | ||
if (this.options.unescape && /^[\w_.-]/.test(node.val)) { | ||
return this.emit(node.val, node); | ||
@@ -74,3 +74,3 @@ } | ||
var parsed = node.parsed; | ||
var val = '\\/'; | ||
var val = '\\' + node.val; | ||
@@ -98,5 +98,10 @@ if (parsed === '**' || parsed === './**') { | ||
inner = inner.replace(/\\(?=[\\\w]|$)/g, '\\\\'); | ||
if (inner === ']-') { | ||
inner = '\\]\\-'; | ||
if (inner === '\\\\') { | ||
inner = '/'; | ||
} else { | ||
inner = inner.replace(/\\+(?=\w|$)/g, '\\\\'); | ||
if (inner === ']-') { | ||
inner = '\\]\\-'; | ||
} | ||
} | ||
@@ -103,0 +108,0 @@ |
@@ -189,3 +189,3 @@ 'use strict'; | ||
utils.normalize = function(str) { | ||
return str.replace(/\\+/g, '/'); | ||
return str.replace(/\\(?![!*+?[\](){}])/g, '/'); | ||
}; | ||
@@ -200,3 +200,3 @@ | ||
utils.stripDrive = function(fp) { | ||
return path.sep === '\\' ? fp.replace(/^[a-z]:\/?/i, '/') : fp; | ||
return path.sep === '\\' ? fp.replace(/^[a-z]:[\\\/]?/i, '/') : fp; | ||
}; | ||
@@ -315,3 +315,3 @@ | ||
options = options || {}; | ||
if (type === 'backslash' || options.unixify === true || options.normalize === true) { | ||
if (type === 'backslash' || options.unixify !== false) { | ||
unixify = function(filepath) { | ||
@@ -329,4 +329,5 @@ return utils.stripPrefix(utils.normalize(filepath)); | ||
} | ||
cache[key] = unixify; | ||
return unixify; | ||
}; |
{ | ||
"name": "nanomatch", | ||
"description": "Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash 4.3 wildcard support only (no support for exglobs, posix brackets or braces)", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"homepage": "https://github.com/jonschlinkert/nanomatch", | ||
@@ -29,5 +29,5 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"fragment-cache": "^0.2.0", | ||
"is-extglob": "^2.1.0", | ||
"is-odd": "^0.1.0", | ||
"kind-of": "^3.0.4", | ||
"is-extglob": "^2.1.1", | ||
"is-odd": "^0.1.1", | ||
"kind-of": "^3.1.0", | ||
"object.pick": "^1.2.0", | ||
@@ -39,4 +39,6 @@ "regex-not": "^1.0.0", | ||
"devDependencies": { | ||
"ansi-cyan": "^0.1.1", | ||
"bash-match": "^0.2.0", | ||
"for-own": "^0.1.4", | ||
"benchmarked": "^0.2.5", | ||
"for-own": "^1.0.0", | ||
"gulp": "^3.9.1", | ||
@@ -47,9 +49,11 @@ "gulp-eslint": "^3.0.1", | ||
"gulp-mocha": "^3.0.1", | ||
"gulp-unused": "^0.2.0", | ||
"gulp-unused": "^0.2.1", | ||
"helper-changelog": "^0.3.0", | ||
"is-windows": "^0.2.0", | ||
"is-primitive": "^2.0.0", | ||
"is-windows": "^1.0.0", | ||
"isobject": "^3.0.0", | ||
"minimatch": "^3.0.3", | ||
"mocha": "^3.1.0", | ||
"mocha": "^3.2.0", | ||
"multimatch": "^2.1.0", | ||
"yargs-parser": "^4.0.2" | ||
"yargs-parser": "^5.0.0" | ||
}, | ||
@@ -95,3 +99,3 @@ "keywords": [ | ||
"verb": { | ||
"toc": true, | ||
"toc": "collapsible", | ||
"layout": "common-minimal", | ||
@@ -98,0 +102,0 @@ "tasks": [ |
194
README.md
@@ -5,4 +5,4 @@ # nanomatch [![NPM version](https://img.shields.io/npm/v/nanomatch.svg?style=flat)](https://www.npmjs.com/package/nanomatch) [![NPM monthly downloads](https://img.shields.io/npm/dm/nanomatch.svg?style=flat)](https://npmjs.org/package/nanomatch) [![NPM total downloads](https://img.shields.io/npm/dt/nanomatch.svg?style=flat)](https://npmjs.org/package/nanomatch) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/nanomatch.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/nanomatch) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/nanomatch.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/nanomatch) | ||
## Table of Contents | ||
<details> | ||
<summary><strong>Table of Contents</strong></summary> | ||
- [What is nanomatch?](#what-is-nanomatch) | ||
@@ -38,5 +38,4 @@ - [Getting started](#getting-started) | ||
* [License](#license) | ||
</details> | ||
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ | ||
## What is nanomatch? | ||
@@ -48,5 +47,5 @@ | ||
* [Features](#features): info about supported patterns, and a glob matching reference | ||
* [API documentation](#api): available options and methods | ||
* [Unit tests](test): there is no better way to learn a code library than spending time the unit tests. Nanomatch has 36,000 of them - go become a glob matching ninja! | ||
* [Features](#features): jump to info about supported patterns, and a glob matching reference | ||
* [API documentation](#api): jump to available options and methods | ||
* [Unit tests](test): visit unit tests. there is no better way to learn a code library than spending time the unit tests. Nanomatch has 36,000 unit tests - go become a glob matching ninja! | ||
@@ -95,2 +94,9 @@ **How is this different from [micromatch](https://github.com/jonschlinkert/micromatch)?** | ||
**Params** | ||
* `list` **{Array}**: A list of strings to match | ||
* `patterns` **{String|Array}**: One or more glob patterns to use for matching. | ||
* `options` **{Object}**: Any [options](#options) to change how matches are performed | ||
* `returns` **{Array}**: Returns an array of matches | ||
**Example** | ||
@@ -106,13 +112,13 @@ | ||
### [.match](index.js#L102) | ||
Similar to the main function, but `pattern` must be a string. | ||
**Params** | ||
* `list` **{Array}**: A list of strings to match | ||
* `patterns` **{String|Array}**: One or more glob patterns to use for matching. | ||
* `list` **{Array}**: Array of strings to match | ||
* `pattern` **{String}**: Glob pattern to use for matching. | ||
* `options` **{Object}**: Any [options](#options) to change how matches are performed | ||
* `returns` **{Array}**: Returns an array of matches | ||
### [.match](index.js#L102) | ||
Similar to the main function, but `pattern` must be a string. | ||
**Example** | ||
@@ -128,13 +134,13 @@ | ||
### [.isMatch](index.js#L165) | ||
Returns true if the specified `string` matches the given glob `pattern`. | ||
**Params** | ||
* `list` **{Array}**: Array of strings to match | ||
* `string` **{String}**: String to match | ||
* `pattern` **{String}**: Glob pattern to use for matching. | ||
* `options` **{Object}**: Any [options](#options) to change how matches are performed | ||
* `returns` **{Array}**: Returns an array of matches | ||
* `returns` **{Boolean}**: Returns true if the string matches the glob pattern. | ||
### [.isMatch](index.js#L165) | ||
Returns true if the specified `string` matches the given glob `pattern`. | ||
**Example** | ||
@@ -152,13 +158,13 @@ | ||
### [.not](index.js#L199) | ||
Returns a list of strings that _DO NOT MATCH_ any of the given `patterns`. | ||
**Params** | ||
* `string` **{String}**: String to match | ||
* `pattern` **{String}**: Glob pattern to use for matching. | ||
* `list` **{Array}**: Array of strings to match. | ||
* `patterns` **{String|Array}**: One or more glob pattern to use for matching. | ||
* `options` **{Object}**: Any [options](#options) to change how matches are performed | ||
* `returns` **{Boolean}**: Returns true if the string matches the glob pattern. | ||
* `returns` **{Array}**: Returns an array of strings that **do not match** the given patterns. | ||
### [.not](index.js#L199) | ||
Returns a list of strings that _DO NOT MATCH_ any of the given `patterns`. | ||
**Example** | ||
@@ -174,13 +180,13 @@ | ||
### [.any](index.js#L236) | ||
Returns true if the given `string` matches any of the given glob `patterns`. | ||
**Params** | ||
* `list` **{Array}**: Array of strings to match. | ||
* `patterns` **{String|Array}**: One or more glob pattern to use for matching. | ||
* `list` **{String|Array}**: The string or array of strings to test. Returns as soon as the first match is found. | ||
* `patterns` **{String|Array}**: One or more glob patterns to use for matching. | ||
* `options` **{Object}**: Any [options](#options) to change how matches are performed | ||
* `returns` **{Array}**: Returns an array of strings that **do not match** the given patterns. | ||
* `returns` **{Boolean}**: Returns true if any patterns match `str` | ||
### [.any](index.js#L236) | ||
Returns true if the given `string` matches any of the given glob `patterns`. | ||
**Example** | ||
@@ -198,13 +204,13 @@ | ||
### [.contains](index.js#L279) | ||
Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string. | ||
**Params** | ||
* `list` **{String|Array}**: The string or array of strings to test. Returns as soon as the first match is found. | ||
* `patterns` **{String|Array}**: One or more glob patterns to use for matching. | ||
* `str` **{String}**: The string to match. | ||
* `pattern` **{String}**: Glob pattern to use for matching. | ||
* `options` **{Object}**: Any [options](#options) to change how matches are performed | ||
* `returns` **{Boolean}**: Returns true if any patterns match `str` | ||
* `returns` **{Boolean}**: Returns true if the patter matches any part of `str`. | ||
### [.contains](index.js#L279) | ||
Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string. | ||
**Example** | ||
@@ -222,13 +228,13 @@ | ||
### [.matchKeys](index.js#L328) | ||
Filter the keys of the given object with the given `glob` pattern and `options`. Does not attempt to match nested keys. If you need this feature, use [glob-object](https://github.com/jonschlinkert/glob-object) instead. | ||
**Params** | ||
* `str` **{String}**: The string to match. | ||
* `pattern` **{String}**: Glob pattern to use for matching. | ||
* `object` **{Object}**: The object with keys to filter. | ||
* `patterns` **{String|Array}**: One or more glob patterns to use for matching. | ||
* `options` **{Object}**: Any [options](#options) to change how matches are performed | ||
* `returns` **{Boolean}**: Returns true if the patter matches any part of `str`. | ||
* `returns` **{Object}**: Returns an object with only keys that match the given patterns. | ||
### [.matchKeys](index.js#L328) | ||
Filter the keys of the given object with the given `glob` pattern and `options`. Does not attempt to match nested keys. If you need this feature, use [glob-object](https://github.com/jonschlinkert/glob-object) instead. | ||
**Example** | ||
@@ -245,9 +251,2 @@ | ||
**Params** | ||
* `object` **{Object}**: The object with keys to filter. | ||
* `patterns` **{String|Array}**: One or more glob patterns to use for matching. | ||
* `options` **{Object}**: Any [options](#options) to change how matches are performed | ||
* `returns` **{Object}**: Returns an object with only keys that match the given patterns. | ||
### [.matcher](index.js#L357) | ||
@@ -257,2 +256,8 @@ | ||
**Params** | ||
* `pattern` **{String}**: Glob pattern | ||
* `options` **{Object}**: Any [options](#options) to change how matches are performed. | ||
* `returns` **{Function}**: Returns a matcher function. | ||
**Example** | ||
@@ -271,12 +276,12 @@ | ||
### [.makeRe](index.js#L423) | ||
Create a regular expression from the given glob `pattern`. | ||
**Params** | ||
* `pattern` **{String}**: Glob pattern | ||
* `pattern` **{String}**: A glob pattern to convert to regex. | ||
* `options` **{Object}**: Any [options](#options) to change how matches are performed. | ||
* `returns` **{Function}**: Returns a matcher function. | ||
* `returns` **{RegExp}**: Returns a regex created from the given pattern. | ||
### [.makeRe](index.js#L419) | ||
Create a regular expression from the given glob `pattern`. | ||
**Example** | ||
@@ -292,11 +297,11 @@ | ||
**Params** | ||
### [.create](index.js#L484) | ||
* `pattern` **{String}**: A glob pattern to convert to regex. | ||
* `options` **{Object}**: Any [options](#options) to change how matches are performed. | ||
* `returns` **{RegExp}**: Returns a regex created from the given pattern. | ||
Parses the given glob `pattern` and returns an object with the compiled `output` and optional source `map`. | ||
### [.create](index.js#L480) | ||
**Params** | ||
Parses the given glob `pattern` and returns an object with the compiled `output` and optional source `map`. | ||
* `pattern` **{String}**: Glob pattern to parse and compile. | ||
* `options` **{Object}**: Any [options](#options) to change how parsing and compiling is performed. | ||
* `returns` **{Object}**: Returns an object with the parsed AST, compiled string and optional source map. | ||
@@ -335,11 +340,11 @@ **Example** | ||
**Params** | ||
### [.parse](index.js#L523) | ||
* `pattern` **{String}**: Glob pattern to parse and compile. | ||
* `options` **{Object}**: Any [options](#options) to change how parsing and compiling is performed. | ||
* `returns` **{Object}**: Returns an object with the parsed AST, compiled string and optional source map. | ||
Parse the given `str` with the given `options`. | ||
### [.parse](index.js#L519) | ||
**Params** | ||
Parse the given `str` with the given `options`. | ||
* `str` **{String}** | ||
* `options` **{Object}** | ||
* `returns` **{Object}**: Returns an AST | ||
@@ -369,12 +374,12 @@ **Example** | ||
### [.compile](index.js#L576) | ||
Compile the given `ast` or string with the given `options`. | ||
**Params** | ||
* `str` **{String}** | ||
* `ast` **{Object|String}** | ||
* `options` **{Object}** | ||
* `returns` **{Object}**: Returns an AST | ||
* `returns` **{Object}**: Returns an object that has an `output` property with the compiled string. | ||
### [.compile](index.js#L572) | ||
Compile the given `ast` or string with the given `options`. | ||
**Example** | ||
@@ -404,10 +409,4 @@ | ||
**Params** | ||
### [.clearCache](index.js#L599) | ||
* `ast` **{Object|String}** | ||
* `options` **{Object}** | ||
* `returns` **{Object}**: Returns an object that has an `output` property with the compiled string. | ||
### [.clearCache](index.js#L595) | ||
Clear the regex cache. | ||
@@ -674,2 +673,3 @@ | ||
fastest is nanomatch | ||
``` | ||
@@ -690,2 +690,12 @@ | ||
### [1.0.1](https://github.com/jonschlinkert/nanomatch/compare/1.0.0...1.0.1) - 2016-12-12 | ||
**Added** | ||
* Support for windows path edge cases where backslashes are used in brackets or other unusual combinations. | ||
### [1.0.0](https://github.com/jonschlinkert/nanomatch/compare/0.1.0...1.0.0) - 2016-12-12 | ||
Stable release. | ||
### [0.1.0] - 2016-10-08 | ||
@@ -706,10 +716,10 @@ | ||
Please read the [contributing guide](.github/contributing.md) for avice on opening issues, pull requests, and coding standards. | ||
Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. | ||
### Running tests | ||
Install dev dependencies: | ||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: | ||
```sh | ||
$ npm install -d && npm test | ||
$ npm install && npm test | ||
``` | ||
@@ -722,11 +732,11 @@ | ||
* [github/jonschlinkert](https://github.com/jonschlinkert) | ||
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) | ||
### License | ||
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
Released under the [MIT license](https://github.com/jonschlinkert/nanomatch/blob/master/LICENSE). | ||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
Released under the [MIT License](LICENSE). | ||
*** | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on December 12, 2016._ | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.3, on March 14, 2017._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64121
1294
721
18
Updatedis-extglob@^2.1.1
Updatedis-odd@^0.1.1
Updatedkind-of@^3.1.0