Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: micromatch/expand-brackets
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9a0ec493825eb0aa9368c158927ca4ace945fefa
Choose a base ref
...
head repository: micromatch/expand-brackets
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1a70cc275197ea0297c915fbac03ea86e3a392ae
Choose a head ref
  • 18 commits
  • 11 files changed
  • 4 contributors

Commits on Apr 28, 2017

  1. Update Repository Urls

    Updates a few entries in the package.json from `jonschlinkert/expand-brackets` to `micromatch/expand-brackets`
    mjbvz authored Apr 28, 2017
    Copy the full SHA
    ae88242 View commit details
  2. Merge pull request #7 from mjbvz/patch-1

    Update Repository Urls For micromatch
    doowb authored Apr 28, 2017
    Copy the full SHA
    cc56339 View commit details

Commits on Mar 21, 2018

  1. Update snapdragon to 0.11

    danez committed Mar 21, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8219034 View commit details

Commits on Mar 25, 2018

  1. Merge pull request #9 from danez/update-snapdragon

    Update snapdragon to 0.11
    danez authored Mar 25, 2018
    Copy the full SHA
    c204656 View commit details
  2. Remove debug

    danez committed Mar 25, 2018
    Copy the full SHA
    7c0bdfc View commit details
  3. Update Readme

    danez committed Mar 25, 2018
    Copy the full SHA
    7e996fb View commit details
  4. Fix appveyor link

    The project in appveyor is still located under the old name, which does not match the repo name
    danez committed Mar 25, 2018
    Copy the full SHA
    232670e View commit details

Commits on Mar 26, 2018

  1. Revert "Fix appveyor link"

    This reverts commit 232670e.
    danez committed Mar 26, 2018
    Copy the full SHA
    3060a56 View commit details
  2. 3.0.0

    danez committed Mar 26, 2018
    Copy the full SHA
    58f2f1f View commit details
  3. Update Readme

    danez committed Mar 26, 2018
    Copy the full SHA
    39b83e3 View commit details

Commits on Apr 30, 2018

  1. Copy the full SHA
    914cfb2 View commit details
  2. Drop support for node <4

    danez committed Apr 30, 2018
    Copy the full SHA
    fb74412 View commit details
  3. Remove extend-shallow

    danez committed Apr 30, 2018
    Copy the full SHA
    f5a833e View commit details
  4. Update dev dependencies

    danez committed Apr 30, 2018
    Copy the full SHA
    13e0d90 View commit details
  5. Use let, const

    danez committed Apr 30, 2018
    Copy the full SHA
    354cfbf View commit details
  6. Update Readme [skip ci]

    danez committed Apr 30, 2018
    Copy the full SHA
    c7ea1c3 View commit details
  7. Update changelog [skip ci]

    danez committed Apr 30, 2018
    Copy the full SHA
    af96dc5 View commit details
  8. 4.0.0

    danez committed Apr 30, 2018
    Copy the full SHA
    1a70cc2 View commit details
Showing with 194 additions and 171 deletions.
  1. +3 −4 .travis.yml
  2. +1 −1 LICENSE
  3. +82 −60 README.md
  4. +3 −3 appveyor.yml
  5. +13 −0 changelog.md
  6. +26 −31 index.js
  7. +6 −6 lib/compilers.js
  8. +42 −45 lib/parsers.js
  9. +6 −6 lib/utils.js
  10. +11 −14 package.json
  11. +1 −1 test/wildmatch.js
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -4,8 +4,7 @@ os:
- linux
- osx
node_js:
- node
- '10'
- '8'
- '6'
- '5'
- '0.12'
- '0.10'
- '4'
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2016, Jon Schlinkert
Copyright (c) 2015-2018, Jon Schlinkert

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
142 changes: 82 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# expand-brackets [![NPM version](https://img.shields.io/npm/v/expand-brackets.svg?style=flat)](https://www.npmjs.com/package/expand-brackets) [![NPM monthly downloads](https://img.shields.io/npm/dm/expand-brackets.svg?style=flat)](https://npmjs.org/package/expand-brackets) [![NPM total downloads](https://img.shields.io/npm/dt/expand-brackets.svg?style=flat)](https://npmjs.org/package/expand-brackets) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/expand-brackets.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/expand-brackets) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/expand-brackets.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/expand-brackets)
# expand-brackets [![NPM version](https://img.shields.io/npm/v/expand-brackets.svg?style=flat)](https://www.npmjs.com/package/expand-brackets) [![NPM monthly downloads](https://img.shields.io/npm/dm/expand-brackets.svg?style=flat)](https://npmjs.org/package/expand-brackets) [![NPM total downloads](https://img.shields.io/npm/dt/expand-brackets.svg?style=flat)](https://npmjs.org/package/expand-brackets) [![Linux Build Status](https://img.shields.io/travis/micromatch/expand-brackets.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/expand-brackets) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/expand-brackets.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/expand-brackets)

> Expand POSIX bracket expressions (character classes) in glob patterns.
@@ -10,6 +10,12 @@ Install with [npm](https://www.npmjs.com/):
$ npm install --save expand-brackets
```

Install with [yarn](https://yarnpkg.com):

```sh
$ yarn add expand-brackets
```

## Usage

```js
@@ -34,7 +40,7 @@ console.log(brackets('[![:lower:]]'));

## API

### [brackets](index.js#L29)
### [brackets](index.js#L27)

Parses the given POSIX character class `pattern` and returns a
string that can be used for creating regular expressions for matching.
@@ -45,99 +51,105 @@ string that can be used for creating regular expressions for matching.
* `options` **{Object}**
* `returns` **{Object}**

### [.match](index.js#L54)
### [.match](index.js#L51)

Takes an array of strings and a POSIX character class pattern, and returns a new array with only the strings that matched the pattern.

**Params**

* `arr` **{Array}**: Array of strings to match
* `pattern` **{String}**: POSIX character class pattern(s)
* `options` **{Object}**
* `returns` **{Array}**

**Example**

```js
var brackets = require('expand-brackets');
const brackets = require('expand-brackets');
console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]'));
//=> ['a']

console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]+'));
//=> ['a', 'ab']
```

**Params**
### [.isMatch](index.js#L97)

* `arr` **{Array}**: Array of strings to match
* `pattern` **{String}**: POSIX character class pattern(s)
* `options` **{Object}**
* `returns` **{Array}**
Returns true if the specified `string` matches the given brackets `pattern`.

### [.isMatch](index.js#L100)
**Params**

Returns true if the specified `string` matches the given brackets `pattern`.
* `string` **{String}**: String to match
* `pattern` **{String}**: Poxis pattern
* `options` **{String}**
* `returns` **{Boolean}**

**Example**

```js
var brackets = require('expand-brackets');
const brackets = require('expand-brackets');

console.log(brackets.isMatch('a.a', '[[:alpha:]].[[:alpha:]]'));
//=> true
console.log(brackets.isMatch('1.2', '[[:alpha:]].[[:alpha:]]'));
//=> false
```

### [.matcher](index.js#L120)

Takes a POSIX character class pattern and returns a matcher function. The returned function takes the string to match as its only argument.

**Params**

* `string` **{String}**: String to match
* `pattern` **{String}**: Poxis pattern
* `options` **{String}**
* `returns` **{Boolean}**

### [.matcher](index.js#L123)

Takes a POSIX character class pattern and returns a matcher function. The returned function takes the string to match as its only argument.

**Example**

```js
var brackets = require('expand-brackets');
var isMatch = brackets.matcher('[[:lower:]].[[:upper:]]');
const brackets = require('expand-brackets');
const isMatch = brackets.matcher('[[:lower:]].[[:upper:]]');

console.log(isMatch('a.a'));
//=> false
console.log(isMatch('a.A'));
//=> true
```

**Params**
### [.makeRe](index.js#L140)

* `pattern` **{String}**: Poxis pattern
* `options` **{String}**
* `returns` **{Boolean}**
Create a regular expression from the given `pattern`.

### [.makeRe](index.js#L145)
**Params**

Create a regular expression from the given `pattern`.
* `pattern` **{String}**: The pattern to convert to regex.
* `options` **{Object}**
* `returns` **{RegExp}**

**Example**

```js
var brackets = require('expand-brackets');
var re = brackets.makeRe('[[:alpha:]]');
const brackets = require('expand-brackets');
const re = brackets.makeRe('[[:alpha:]]');
console.log(re);
//=> /^(?:[a-zA-Z])$/
```

**Params**
### [.create](index.js#L182)

* `pattern` **{String}**: The pattern to convert to regex.
* `options` **{Object}**
* `returns` **{RegExp}**
Parses the given POSIX character class `pattern` and returns an object with the compiled `output` and optional source `map`.

### [.create](index.js#L187)
**Params**

Parses the given POSIX character class `pattern` and returns an object with the compiled `output` and optional source `map`.
* `pattern` **{String}**
* `options` **{Object}**
* `returns` **{Object}**

**Example**

```js
var brackets = require('expand-brackets');
const brackets = require('expand-brackets');
console.log(brackets('[[:alpha:]]'));
// { options: { source: 'string' },
// input: '[[:alpha:]]',
@@ -163,12 +175,6 @@ console.log(brackets('[[:alpha:]]'));
// parsingErrors: [] }
```

**Params**

* `pattern` **{String}**
* `options` **{Object}**
* `returns` **{Object}**

## Options

### options.sourcemap
@@ -211,6 +217,19 @@ See [posix-character-classes](https://github.com/jonschlinkert/posix-character-c

## Changelog

### v4.0.0

**Breaking changes**

* Snapdragon was updated to 0.12. Other packages that integrate `expand-brackets` need to also use snapdragon 0.12.
* Minimum Node.JS version is now version 4.

### v3.0.0

**Breaking changes**

* Snapdragon was updated to 0.11. Other packages that integrate `expand-brackets` need to also use snapdragon 0.11.

### v2.0.0

**Breaking changes**
@@ -227,7 +246,7 @@ In addition to performance and matching improvements, the v0.2.0 refactor adds c

**Added features**

* parser is exposed, so that expand-brackets parsers can be used by upstream parsers (like [micromatch](https://github.com/jonschlinkert/micromatch))
* parser is exposed, so that expand-brackets parsers can be used by upstream parsers (like [micromatch](https://github.com/micromatch/micromatch))
* compiler is exposed, so that expand-brackets compilers can be used by upstream compilers
* source maps

@@ -249,54 +268,57 @@ console.log(res.map);

### Related projects

* [braces](https://www.npmjs.com/package/braces): Fast, comprehensive, bash-like brace expansion implemented in JavaScript. Complete support for the Bash 4.3 braces[more](https://github.com/jonschlinkert/braces) | [homepage](https://github.com/jonschlinkert/braces "Fast, comprehensive, bash-like brace expansion implemented in JavaScript. Complete support for the Bash 4.3 braces specification, without sacrificing speed.")
* [extglob](https://www.npmjs.com/package/extglob): Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob… [more](https://github.com/jonschlinkert/extglob) | [homepage](https://github.com/jonschlinkert/extglob "Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.")
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.")
* [nanomatch](https://www.npmjs.com/package/nanomatch): Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash… [more](https://github.com/jonschlinkert/nanomatch) | [homepage](https://github.com/jonschlinkert/nanomatch "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)")
* [braces](https://www.npmjs.com/package/braces): Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support[more](https://github.com/micromatch/braces) | [homepage](https://github.com/micromatch/braces "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.")
* [extglob](https://www.npmjs.com/package/extglob): Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob… [more](https://github.com/micromatch/extglob) | [homepage](https://github.com/micromatch/extglob "Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.")
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.")
* [nanomatch](https://www.npmjs.com/package/nanomatch): Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash… [more](https://github.com/micromatch/nanomatch) | [homepage](https://github.com/micromatch/nanomatch "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)")

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

### Contributors

| **Commits** | **Contributor**<br/> |
| --- | --- |
| 66 | [jonschlinkert](https://github.com/jonschlinkert) |
| 2 | [MartinKolarik](https://github.com/MartinKolarik) |
| 2 | [es128](https://github.com/es128) |
| 1 | [eush77](https://github.com/eush77) |
| **Commits** | **Contributor** |
| --- | --- |
| 69 | [jonschlinkert](https://github.com/jonschlinkert) |
| 13 | [danez](https://github.com/danez) |
| 2 | [MartinKolarik](https://github.com/MartinKolarik) |
| 2 | [es128](https://github.com/es128) |
| 1 | [doowb](https://github.com/doowb) |
| 1 | [eush77](https://github.com/eush77) |
| 1 | [mjbvz](https://github.com/mjbvz) |

### Building docs

_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
To generate the readme, run the following command:

```sh
$ npm install -g verb verb-generate-readme && verb
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```

### 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
```

### Author

**Jon Schlinkert**

* [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/expand-brackets/blob/master/LICENSE).
Copyright © 2018, [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.6.0, on April 30, 2018._
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -2,10 +2,10 @@
environment:
matrix:
# node.js
- nodejs_version: "10.0"
- nodejs_version: "8.0"
- nodejs_version: "6.0"
- nodejs_version: "5.0"
- nodejs_version: "0.12"
- nodejs_version: "0.10"
- nodejs_version: "4.0"

# Install scripts. (runs after repo cloning)
install:
13 changes: 13 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
## Changelog

### v4.0.0

**Breaking changes**

- Snapdragon was updated to 0.12. Other packages that integrate `expand-brackets` need to also use snapdragon 0.12.
- Minimum Node.JS version is now version 4.

### v3.0.0

**Breaking changes**

- Snapdragon was updated to 0.11. Other packages that integrate `expand-brackets` need to also use snapdragon 0.11.

### v2.0.0

**Breaking changes**
Loading