diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
commit | abd94a7f5a50f43c797a11b53549ae48fff667c3 (patch) | |
tree | ab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/braces | |
parent | a0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff) | |
download | wallet-core-abd94a7f5a50f43c797a11b53549ae48fff667c3.tar.xz |
add node_modules to address #4364
Diffstat (limited to 'node_modules/braces')
-rw-r--r-- | node_modules/braces/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/braces/README.md | 248 | ||||
-rw-r--r-- | node_modules/braces/index.js | 399 | ||||
-rw-r--r-- | node_modules/braces/package.json | 157 |
4 files changed, 825 insertions, 0 deletions
diff --git a/node_modules/braces/LICENSE b/node_modules/braces/LICENSE new file mode 100644 index 000000000..39245ac1c --- /dev/null +++ b/node_modules/braces/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-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/braces/README.md b/node_modules/braces/README.md new file mode 100644 index 000000000..52fa7569b --- /dev/null +++ b/node_modules/braces/README.md @@ -0,0 +1,248 @@ +# braces [![NPM version](https://img.shields.io/npm/v/braces.svg?style=flat)](https://www.npmjs.com/package/braces) [![NPM downloads](https://img.shields.io/npm/dm/braces.svg?style=flat)](https://npmjs.org/package/braces) [![Build Status](https://img.shields.io/travis/jonschlinkert/braces.svg?style=flat)](https://travis-ci.org/jonschlinkert/braces) + +Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install braces --save +``` + +## Features + +* Complete support for the braces part of the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/). Braces passes [all of the relevant unit tests](#bash-4-3-support) from the spec. +* Expands comma-separated values: `a/{b,c}/d` => `['a/b/d', 'a/c/d']` +* Expands alphabetical or numerical ranges: `{1..3}` => `['1', '2', '3']` +* [Very fast](#benchmarks) +* [Special characters](./patterns.md) can be used to generate interesting patterns. + +## Example usage + +```js +var braces = require('braces'); + +braces('a/{x,y}/c{d}e') +//=> ['a/x/cde', 'a/y/cde'] + +braces('a/b/c/{x,y}') +//=> ['a/b/c/x', 'a/b/c/y'] + +braces('a/{x,{1..5},y}/c{d}e') +//=> ['a/x/cde', 'a/1/cde', 'a/y/cde', 'a/2/cde', 'a/3/cde', 'a/4/cde', 'a/5/cde'] +``` + +### Use case: fixtures + +> Use braces to generate test fixtures! + +**Example** + +```js +var braces = require('./'); +var path = require('path'); +var fs = require('fs'); + +braces('blah/{a..z}.js').forEach(function(fp) { + if (!fs.existsSync(path.dirname(fp))) { + fs.mkdirSync(path.dirname(fp)); + } + fs.writeFileSync(fp, ''); +}); +``` + +See the [tests](./test/test.js) for more examples and use cases (also see the [bash spec tests](./test/bash-mm-adjusted.js)); + +### Range expansion + +Uses [expand-range](https://github.com/jonschlinkert/expand-range) for range expansion. + +```js +braces('a{1..3}b') +//=> ['a1b', 'a2b', 'a3b'] + +braces('a{5..8}b') +//=> ['a5b', 'a6b', 'a7b', 'a8b'] + +braces('a{00..05}b') +//=> ['a00b', 'a01b', 'a02b', 'a03b', 'a04b', 'a05b'] + +braces('a{01..03}b') +//=> ['a01b', 'a02b', 'a03b'] + +braces('a{000..005}b') +//=> ['a000b', 'a001b', 'a002b', 'a003b', 'a004b', 'a005b'] + +braces('a{a..e}b') +//=> ['aab', 'abb', 'acb', 'adb', 'aeb'] + +braces('a{A..E}b') +//=> ['aAb', 'aBb', 'aCb', 'aDb', 'aEb'] +``` + +Pass a function as the last argument to customize range expansions: + +```js +var range = braces('x{a..e}y', function (str, i) { + return String.fromCharCode(str) + i; +}); + +console.log(range); +//=> ['xa0y', 'xb1y', 'xc2y', 'xd3y', 'xe4y'] +``` + +See [expand-range](https://github.com/jonschlinkert/expand-range) for benchmarks, tests and the full list of range expansion features. + +## Options + +### options.makeRe + +Type: `Boolean` + +Deafault: `false` + +Return a regex-optimal string. If you're using braces to generate regex, this will result in dramatically faster performance. + +**Examples** + +With the default settings (`{makeRe: false}`): + +```js +braces('{1..5}'); +//=> ['1', '2', '3', '4', '5'] +``` + +With `{makeRe: true}`: + +```js +braces('{1..5}', {makeRe: true}); +//=> ['[1-5]'] + +braces('{3..9..3}', {makeRe: true}); +//=> ['(3|6|9)'] +``` + +### options.bash + +Type: `Boolean` + +Default: `false` + +Enables complete support for the Bash specification. The downside is a 20-25% speed decrease. + +**Example** + +Using the default setting (`{bash: false}`): + +```js +braces('a{b}c'); +//=> ['abc'] +``` + +In bash (and minimatch), braces with one item are not expanded. To get the same result with braces, set `{bash: true}`: + +```js +braces('a{b}c', {bash: true}); +//=> ['a{b}c'] +``` + +### options.nodupes + +Type: `Boolean` + +Deafault: `true` + +Duplicates are removed by default. To keep duplicates, pass `{nodupes: false}` on the options + +## Bash 4.3 Support + +> Better support for Bash 4.3 than minimatch + +This project has comprehensive unit tests, including tests coverted from [Bash 4.3](www.gnu.org/software/bash/). Currently only 8 of 102 unit tests fail, and + +## Run benchmarks + +Install dev dependencies: + +```bash +npm i -d && npm benchmark +``` + +### Latest results + +```bash +#1: escape.js + brace-expansion.js x 114,934 ops/sec ±1.24% (93 runs sampled) + braces.js x 342,254 ops/sec ±0.84% (90 runs sampled) + +#2: exponent.js + brace-expansion.js x 12,359 ops/sec ±0.86% (96 runs sampled) + braces.js x 20,389 ops/sec ±0.71% (97 runs sampled) + +#3: multiple.js + brace-expansion.js x 114,469 ops/sec ±1.44% (94 runs sampled) + braces.js x 401,621 ops/sec ±0.87% (91 runs sampled) + +#4: nested.js + brace-expansion.js x 102,769 ops/sec ±1.55% (92 runs sampled) + braces.js x 314,088 ops/sec ±0.71% (98 runs sampled) + +#5: normal.js + brace-expansion.js x 157,577 ops/sec ±1.65% (91 runs sampled) + braces.js x 1,115,950 ops/sec ±0.74% (94 runs sampled) + +#6: range.js + brace-expansion.js x 138,822 ops/sec ±1.71% (91 runs sampled) + braces.js x 1,108,353 ops/sec ±0.85% (94 runs sampled) +``` + +## Related projects + +You might also be interested in these projects: + +* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See… [more](https://www.npmjs.com/package/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range) +* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier to… [more](https://www.npmjs.com/package/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range) +* [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) + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/braces/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 + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/braces/blob/master/LICENSE). + +*** + +_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 21, 2016._
\ No newline at end of file diff --git a/node_modules/braces/index.js b/node_modules/braces/index.js new file mode 100644 index 000000000..3b4c58d7a --- /dev/null +++ b/node_modules/braces/index.js @@ -0,0 +1,399 @@ +/*! + * braces <https://github.com/jonschlinkert/braces> + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT license. + */ + +'use strict'; + +/** + * Module dependencies + */ + +var expand = require('expand-range'); +var repeat = require('repeat-element'); +var tokens = require('preserve'); + +/** + * Expose `braces` + */ + +module.exports = function(str, options) { + if (typeof str !== 'string') { + throw new Error('braces expects a string'); + } + return braces(str, options); +}; + +/** + * Expand `{foo,bar}` or `{1..5}` braces in the + * given `string`. + * + * @param {String} `str` + * @param {Array} `arr` + * @param {Object} `options` + * @return {Array} + */ + +function braces(str, arr, options) { + if (str === '') { + return []; + } + + if (!Array.isArray(arr)) { + options = arr; + arr = []; + } + + var opts = options || {}; + arr = arr || []; + + if (typeof opts.nodupes === 'undefined') { + opts.nodupes = true; + } + + var fn = opts.fn; + var es6; + + if (typeof opts === 'function') { + fn = opts; + opts = {}; + } + + if (!(patternRe instanceof RegExp)) { + patternRe = patternRegex(); + } + + var matches = str.match(patternRe) || []; + var m = matches[0]; + + switch(m) { + case '\\,': + return escapeCommas(str, arr, opts); + case '\\.': + return escapeDots(str, arr, opts); + case '\/.': + return escapePaths(str, arr, opts); + case ' ': + return splitWhitespace(str); + case '{,}': + return exponential(str, opts, braces); + case '{}': + return emptyBraces(str, arr, opts); + case '\\{': + case '\\}': + return escapeBraces(str, arr, opts); + case '${': + if (!/\{[^{]+\{/.test(str)) { + return arr.concat(str); + } else { + es6 = true; + str = tokens.before(str, es6Regex()); + } + } + + if (!(braceRe instanceof RegExp)) { + braceRe = braceRegex(); + } + + var match = braceRe.exec(str); + if (match == null) { + return [str]; + } + + var outter = match[1]; + var inner = match[2]; + if (inner === '') { return [str]; } + + var segs, segsLength; + + if (inner.indexOf('..') !== -1) { + segs = expand(inner, opts, fn) || inner.split(','); + segsLength = segs.length; + + } else if (inner[0] === '"' || inner[0] === '\'') { + return arr.concat(str.split(/['"]/).join('')); + + } else { + segs = inner.split(','); + if (opts.makeRe) { + return braces(str.replace(outter, wrap(segs, '|')), opts); + } + + segsLength = segs.length; + if (segsLength === 1 && opts.bash) { + segs[0] = wrap(segs[0], '\\'); + } + } + + var len = segs.length; + var i = 0, val; + + while (len--) { + var path = segs[i++]; + + if (/(\.[^.\/])/.test(path)) { + if (segsLength > 1) { + return segs; + } else { + return [str]; + } + } + + val = splice(str, outter, path); + + if (/\{[^{}]+?\}/.test(val)) { + arr = braces(val, arr, opts); + } else if (val !== '') { + if (opts.nodupes && arr.indexOf(val) !== -1) { continue; } + arr.push(es6 ? tokens.after(val) : val); + } + } + + if (opts.strict) { return filter(arr, filterEmpty); } + return arr; +} + +/** + * Expand exponential ranges + * + * `a{,}{,}` => ['a', 'a', 'a', 'a'] + */ + +function exponential(str, options, fn) { + if (typeof options === 'function') { + fn = options; + options = null; + } + + var opts = options || {}; + var esc = '__ESC_EXP__'; + var exp = 0; + var res; + + var parts = str.split('{,}'); + if (opts.nodupes) { + return fn(parts.join(''), opts); + } + + exp = parts.length - 1; + res = fn(parts.join(esc), opts); + var len = res.length; + var arr = []; + var i = 0; + + while (len--) { + var ele = res[i++]; + var idx = ele.indexOf(esc); + + if (idx === -1) { + arr.push(ele); + + } else { + ele = ele.split('__ESC_EXP__').join(''); + if (!!ele && opts.nodupes !== false) { + arr.push(ele); + + } else { + var num = Math.pow(2, exp); + arr.push.apply(arr, repeat(ele, num)); + } + } + } + return arr; +} + +/** + * Wrap a value with parens, brackets or braces, + * based on the given character/separator. + * + * @param {String|Array} `val` + * @param {String} `ch` + * @return {String} + */ + +function wrap(val, ch) { + if (ch === '|') { + return '(' + val.join(ch) + ')'; + } + if (ch === ',') { + return '{' + val.join(ch) + '}'; + } + if (ch === '-') { + return '[' + val.join(ch) + ']'; + } + if (ch === '\\') { + return '\\{' + val + '\\}'; + } +} + +/** + * Handle empty braces: `{}` + */ + +function emptyBraces(str, arr, opts) { + return braces(str.split('{}').join('\\{\\}'), arr, opts); +} + +/** + * Filter out empty-ish values + */ + +function filterEmpty(ele) { + return !!ele && ele !== '\\'; +} + +/** + * Handle patterns with whitespace + */ + +function splitWhitespace(str) { + var segs = str.split(' '); + var len = segs.length; + var res = []; + var i = 0; + + while (len--) { + res.push.apply(res, braces(segs[i++])); + } + return res; +} + +/** + * Handle escaped braces: `\\{foo,bar}` + */ + +function escapeBraces(str, arr, opts) { + if (!/\{[^{]+\{/.test(str)) { + return arr.concat(str.split('\\').join('')); + } else { + str = str.split('\\{').join('__LT_BRACE__'); + str = str.split('\\}').join('__RT_BRACE__'); + return map(braces(str, arr, opts), function(ele) { + ele = ele.split('__LT_BRACE__').join('{'); + return ele.split('__RT_BRACE__').join('}'); + }); + } +} + +/** + * Handle escaped dots: `{1\\.2}` + */ + +function escapeDots(str, arr, opts) { + if (!/[^\\]\..+\\\./.test(str)) { + return arr.concat(str.split('\\').join('')); + } else { + str = str.split('\\.').join('__ESC_DOT__'); + return map(braces(str, arr, opts), function(ele) { + return ele.split('__ESC_DOT__').join('.'); + }); + } +} + +/** + * Handle escaped dots: `{1\\.2}` + */ + +function escapePaths(str, arr, opts) { + str = str.split('\/.').join('__ESC_PATH__'); + return map(braces(str, arr, opts), function(ele) { + return ele.split('__ESC_PATH__').join('\/.'); + }); +} + +/** + * Handle escaped commas: `{a\\,b}` + */ + +function escapeCommas(str, arr, opts) { + if (!/\w,/.test(str)) { + return arr.concat(str.split('\\').join('')); + } else { + str = str.split('\\,').join('__ESC_COMMA__'); + return map(braces(str, arr, opts), function(ele) { + return ele.split('__ESC_COMMA__').join(','); + }); + } +} + +/** + * Regex for common patterns + */ + +function patternRegex() { + return /\${|( (?=[{,}])|(?=[{,}]) )|{}|{,}|\\,(?=.*[{}])|\/\.(?=.*[{}])|\\\.(?={)|\\{|\\}/; +} + +/** + * Braces regex. + */ + +function braceRegex() { + return /.*(\\?\{([^}]+)\})/; +} + +/** + * es6 delimiter regex. + */ + +function es6Regex() { + return /\$\{([^}]+)\}/; +} + +var braceRe; +var patternRe; + +/** + * Faster alternative to `String.replace()` when the + * index of the token to be replaces can't be supplied + */ + +function splice(str, token, replacement) { + var i = str.indexOf(token); + return str.substr(0, i) + replacement + + str.substr(i + token.length); +} + +/** + * Fast array map + */ + +function map(arr, fn) { + if (arr == null) { + return []; + } + + var len = arr.length; + var res = new Array(len); + var i = -1; + + while (++i < len) { + res[i] = fn(arr[i], i, arr); + } + + return res; +} + +/** + * Fast array filter + */ + +function filter(arr, cb) { + if (arr == null) return []; + if (typeof cb !== 'function') { + throw new TypeError('braces: filter expects a callback function.'); + } + + var len = arr.length; + var res = arr.slice(); + var i = 0; + + while (len--) { + if (!cb(arr[len], i++)) { + res.splice(len, 1); + } + } + return res; +} diff --git a/node_modules/braces/package.json b/node_modules/braces/package.json new file mode 100644 index 000000000..4ddebfc08 --- /dev/null +++ b/node_modules/braces/package.json @@ -0,0 +1,157 @@ +{ + "_args": [ + [ + { + "raw": "braces@^1.8.2", + "scope": null, + "escapedName": "braces", + "name": "braces", + "rawSpec": "^1.8.2", + "spec": ">=1.8.2 <2.0.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/micromatch" + ] + ], + "_from": "braces@>=1.8.2 <2.0.0", + "_id": "braces@1.8.5", + "_inCache": true, + "_location": "/braces", + "_nodeVersion": "5.5.0", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/braces-1.8.5.tgz_1463843581552_0.5618140168953687" + }, + "_npmUser": { + "name": "jonschlinkert", + "email": "github@sellside.com" + }, + "_npmVersion": "3.6.0", + "_phantomChildren": {}, + "_requested": { + "raw": "braces@^1.8.2", + "scope": null, + "escapedName": "braces", + "name": "braces", + "rawSpec": "^1.8.2", + "spec": ">=1.8.2 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/micromatch" + ], + "_resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "_shasum": "ba77962e12dff969d6b76711e914b737857bf6a7", + "_shrinkwrap": null, + "_spec": "braces@^1.8.2", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/braces/issues" + }, + "dependencies": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + }, + "description": "Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.", + "devDependencies": { + "benchmarked": "^0.1.5", + "brace-expansion": "^1.1.3", + "chalk": "^1.1.3", + "gulp-format-md": "^0.1.8", + "minimatch": "^3.0.0", + "minimist": "^1.2.0", + "mocha": "^2.4.5", + "should": "^8.3.1" + }, + "directories": {}, + "dist": { + "shasum": "ba77962e12dff969d6b76711e914b737857bf6a7", + "tarball": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "gitHead": "24874614ebeda1c5405180f1f6c9f374bcf384ce", + "homepage": "https://github.com/jonschlinkert/braces", + "keywords": [ + "alpha", + "alphabetical", + "bash", + "brace", + "expand", + "expansion", + "filepath", + "fill", + "fs", + "glob", + "globbing", + "letter", + "match", + "matches", + "matching", + "number", + "numerical", + "path", + "range", + "ranges", + "sh" + ], + "license": "MIT", + "main": "index.js", + "maintainers": [ + { + "name": "jonschlinkert", + "email": "github@sellside.com" + }, + { + "name": "es128", + "email": "elan.shanker+npm@gmail.com" + }, + { + "name": "doowb", + "email": "brian.woodward@gmail.com" + } + ], + "name": "braces", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/braces.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "plugins": [ + "gulp-format-md" + ], + "reflinks": [ + "verb" + ], + "toc": false, + "layout": "default", + "lint": { + "reflinks": true + }, + "tasks": [ + "readme" + ], + "related": { + "list": [ + "micromatch", + "expand-range", + "fill-range" + ] + } + }, + "version": "1.8.5" +} |