aboutsummaryrefslogtreecommitdiff
path: root/node_modules/expand-brackets
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/expand-brackets')
-rw-r--r--node_modules/expand-brackets/LICENSE21
-rw-r--r--node_modules/expand-brackets/README.md107
-rw-r--r--node_modules/expand-brackets/index.js163
-rw-r--r--node_modules/expand-brackets/package.json62
4 files changed, 353 insertions, 0 deletions
diff --git a/node_modules/expand-brackets/LICENSE b/node_modules/expand-brackets/LICENSE
new file mode 100644
index 000000000..1e49edf81
--- /dev/null
+++ b/node_modules/expand-brackets/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015-2016, 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
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/expand-brackets/README.md b/node_modules/expand-brackets/README.md
new file mode 100644
index 000000000..d3c913e7a
--- /dev/null
+++ b/node_modules/expand-brackets/README.md
@@ -0,0 +1,107 @@
+# expand-brackets [![NPM version](https://img.shields.io/npm/v/expand-brackets.svg?style=flat)](https://www.npmjs.com/package/expand-brackets) [![NPM downloads](https://img.shields.io/npm/dm/expand-brackets.svg?style=flat)](https://npmjs.org/package/expand-brackets) [![Build Status](https://img.shields.io/travis/jonschlinkert/expand-brackets.svg?style=flat)](https://travis-ci.org/jonschlinkert/expand-brackets)
+
+> Expand POSIX bracket expressions (character classes) in glob patterns.
+
+## Install
+
+Install with [npm](https://www.npmjs.com/):
+
+```sh
+$ npm install expand-brackets --save
+```
+
+## Usage
+
+```js
+var brackets = require('expand-brackets');
+
+brackets('[![:lower:]]');
+//=> '[^a-z]'
+```
+
+## .isMatch
+
+Return true if the given string matches the bracket expression:
+
+```js
+brackets.isMatch('A', '[![:lower:]]');
+//=> true
+
+brackets.isMatch('a', '[![:lower:]]');
+//=> false
+```
+
+## .makeRe
+
+Make a regular expression from a bracket expression:
+
+```js
+brackets.makeRe('[![:lower:]]');
+//=> /[^a-z]/
+```
+
+The following named POSIX bracket expressions are supported:
+
+* `[:alnum:]`: Alphanumeric characters (`a-zA-Z0-9]`)
+* `[:alpha:]`: Alphabetic characters (`a-zA-Z]`)
+* `[:blank:]`: Space and tab (`[ t]`)
+* `[:digit:]`: Digits (`[0-9]`)
+* `[:lower:]`: Lowercase letters (`[a-z]`)
+* `[:punct:]`: Punctuation and symbols. (`[!"#$%&'()*+, -./:;<=>?@ [\]^_``{|}~]`)
+* `[:upper:]`: Uppercase letters (`[A-Z]`)
+* `[:word:]`: Word characters (letters, numbers and underscores) (`[A-Za-z0-9_]`)
+* `[:xdigit:]`: Hexadecimal digits (`[A-Fa-f0-9]`)
+
+Collating sequences are not supported.
+
+## Related projects
+
+You might also be interested in these projects:
+
+* [extglob](https://www.npmjs.com/package/extglob): Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to… [more](https://www.npmjs.com/package/extglob) | [homepage](https://github.com/jonschlinkert/extglob)
+* [is-extglob](https://www.npmjs.com/package/is-extglob): Returns true if a string has an extglob. | [homepage](https://github.com/jonschlinkert/is-extglob)
+* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern.… [more](https://www.npmjs.com/package/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob)
+* [is-posix-bracket](https://www.npmjs.com/package/is-posix-bracket): Returns true if the given string is a POSIX bracket expression (POSIX character class). | [homepage](https://github.com/jonschlinkert/is-posix-bracket)
+* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://www.npmjs.com/package/micromatch) | [homepage](https://github.com/jonschlinkert/micromatch)
+
+## Contributing
+
+Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/expand-brackets/issues/new).
+
+## Building docs
+
+Generate readme and API documentation with [verb](https://github.com/verbose/verb):
+
+```sh
+$ npm install verb && npm run docs
+```
+
+Or, if [verb](https://github.com/verbose/verb) is installed globally:
+
+```sh
+$ verb
+```
+
+## Running tests
+
+Install dev dependencies:
+
+```sh
+$ npm install -d && npm test
+```
+
+## Author
+
+**Jon Schlinkert**
+
+* [github/jonschlinkert](https://github.com/jonschlinkert)
+* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+
+## License
+
+verb © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
+Released under the [MIT license](https://github.com/jonschlinkert/expand-brackets/blob/master/LICENSE).
+
+***
+
+_This file was generated by [verb](https://github.com/verbose/verb), v, on April 01, 2016._ \ No newline at end of file
diff --git a/node_modules/expand-brackets/index.js b/node_modules/expand-brackets/index.js
new file mode 100644
index 000000000..b843cc2b1
--- /dev/null
+++ b/node_modules/expand-brackets/index.js
@@ -0,0 +1,163 @@
+/*!
+ * expand-brackets <https://github.com/jonschlinkert/expand-brackets>
+ *
+ * Copyright (c) 2015 Jon Schlinkert.
+ * Licensed under the MIT license.
+ */
+
+'use strict';
+
+var isPosixBracket = require('is-posix-bracket');
+
+/**
+ * POSIX character classes
+ */
+
+var POSIX = {
+ alnum: 'a-zA-Z0-9',
+ alpha: 'a-zA-Z',
+ blank: ' \\t',
+ cntrl: '\\x00-\\x1F\\x7F',
+ digit: '0-9',
+ graph: '\\x21-\\x7E',
+ lower: 'a-z',
+ print: '\\x20-\\x7E',
+ punct: '-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
+ space: ' \\t\\r\\n\\v\\f',
+ upper: 'A-Z',
+ word: 'A-Za-z0-9_',
+ xdigit: 'A-Fa-f0-9',
+};
+
+/**
+ * Expose `brackets`
+ */
+
+module.exports = brackets;
+
+function brackets(str) {
+ if (!isPosixBracket(str)) {
+ return str;
+ }
+
+ var negated = false;
+ if (str.indexOf('[^') !== -1) {
+ negated = true;
+ str = str.split('[^').join('[');
+ }
+ if (str.indexOf('[!') !== -1) {
+ negated = true;
+ str = str.split('[!').join('[');
+ }
+
+ var a = str.split('[');
+ var b = str.split(']');
+ var imbalanced = a.length !== b.length;
+
+ var parts = str.split(/(?::\]\[:|\[?\[:|:\]\]?)/);
+ var len = parts.length, i = 0;
+ var end = '', beg = '';
+ var res = [];
+
+ // start at the end (innermost) first
+ while (len--) {
+ var inner = parts[i++];
+ if (inner === '^[!' || inner === '[!') {
+ inner = '';
+ negated = true;
+ }
+
+ var prefix = negated ? '^' : '';
+ var ch = POSIX[inner];
+
+ if (ch) {
+ res.push('[' + prefix + ch + ']');
+ } else if (inner) {
+ if (/^\[?\w-\w\]?$/.test(inner)) {
+ if (i === parts.length) {
+ res.push('[' + prefix + inner);
+ } else if (i === 1) {
+ res.push(prefix + inner + ']');
+ } else {
+ res.push(prefix + inner);
+ }
+ } else {
+ if (i === 1) {
+ beg += inner;
+ } else if (i === parts.length) {
+ end += inner;
+ } else {
+ res.push('[' + prefix + inner + ']');
+ }
+ }
+ }
+ }
+
+ var result = res.join('|');
+ var rlen = res.length || 1;
+ if (rlen > 1) {
+ result = '(?:' + result + ')';
+ rlen = 1;
+ }
+ if (beg) {
+ rlen++;
+ if (beg.charAt(0) === '[') {
+ if (imbalanced) {
+ beg = '\\[' + beg.slice(1);
+ } else {
+ beg += ']';
+ }
+ }
+ result = beg + result;
+ }
+ if (end) {
+ rlen++;
+ if (end.slice(-1) === ']') {
+ if (imbalanced) {
+ end = end.slice(0, end.length - 1) + '\\]';
+ } else {
+ end = '[' + end;
+ }
+ }
+ result += end;
+ }
+
+ if (rlen > 1) {
+ result = result.split('][').join(']|[');
+ if (result.indexOf('|') !== -1 && !/\(\?/.test(result)) {
+ result = '(?:' + result + ')';
+ }
+ }
+
+ result = result.replace(/\[+=|=\]+/g, '\\b');
+ return result;
+}
+
+brackets.makeRe = function(pattern) {
+ try {
+ return new RegExp(brackets(pattern));
+ } catch (err) {}
+};
+
+brackets.isMatch = function(str, pattern) {
+ try {
+ return brackets.makeRe(pattern).test(str);
+ } catch (err) {
+ return false;
+ }
+};
+
+brackets.match = function(arr, pattern) {
+ var len = arr.length, i = 0;
+ var res = arr.slice();
+
+ var re = brackets.makeRe(pattern);
+ while (i < len) {
+ var ele = arr[i++];
+ if (!re.test(ele)) {
+ continue;
+ }
+ res.splice(i, 1);
+ }
+ return res;
+};
diff --git a/node_modules/expand-brackets/package.json b/node_modules/expand-brackets/package.json
new file mode 100644
index 000000000..99dddafc7
--- /dev/null
+++ b/node_modules/expand-brackets/package.json
@@ -0,0 +1,62 @@
+{
+ "name": "expand-brackets",
+ "description": "Expand POSIX bracket expressions (character classes) in glob patterns.",
+ "version": "0.1.5",
+ "homepage": "https://github.com/jonschlinkert/expand-brackets",
+ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
+ "repository": "jonschlinkert/expand-brackets",
+ "bugs": {
+ "url": "https://github.com/jonschlinkert/expand-brackets/issues"
+ },
+ "license": "MIT",
+ "files": [
+ "index.js"
+ ],
+ "main": "index.js",
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "scripts": {
+ "test": "mocha"
+ },
+ "dependencies": {
+ "is-posix-bracket": "^0.1.0"
+ },
+ "devDependencies": {
+ "gulp-format-md": "^0.1.7",
+ "mocha": "^2.2.5",
+ "should": "^7.0.2"
+ },
+ "keywords": [
+ "bracket",
+ "character class",
+ "expression",
+ "posix"
+ ],
+ "verb": {
+ "run": true,
+ "toc": false,
+ "layout": "default",
+ "tasks": [
+ "readme"
+ ],
+ "plugins": [
+ "gulp-format-md"
+ ],
+ "related": {
+ "list": [
+ "extglob",
+ "is-extglob",
+ "is-glob",
+ "is-posix-bracket",
+ "micromatch"
+ ]
+ },
+ "reflinks": [
+ "verb"
+ ],
+ "lint": {
+ "reflinks": true
+ }
+ }
+}