npm and error messages

This commit is contained in:
2018-10-27 03:51:47 -05:00
parent 692ab70565
commit 025a403027
29601 changed files with 2759363 additions and 14 deletions

97
node_modules/http-proxy-middleware/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,97 @@
# Changelog
## [v0.17.4](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.17.4)
- fix(ntlm authentication): fixed bug preventing proxying with ntlm authentication. ([#132](https://github.com/chimurai/http-proxy-middleware/pull/149)) (Thanks: [EladBezalel](https://github.com/EladBezalel), [oshri551](https://github.com/oshri551))
## [v0.17.3](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.17.3)
- fix(onError): improve default proxy error handling. http status codes (504, 502 and 500). ([#132](https://github.com/chimurai/http-proxy-middleware/pull/132)) ([graingert](https://github.com/graingert))
## [v0.17.2](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.17.2)
- feat(logging): improve error message & add link to Node errors page. ([#106](https://github.com/chimurai/http-proxy-middleware/pull/106)) ([cloudmu](https://github.com/cloudmu))
- feat(pathRewrite): path can be empty string. ([#110](https://github.com/chimurai/http-proxy-middleware/pull/110)) ([sunnylqm](https://github.com/sunnylqm))
- bug(websocket): memory leak when option 'ws:true' is used. ([#114](https://github.com/chimurai/http-proxy-middleware/pull/114)) ([julbra](https://github.com/julbra))
- chore(package.json): reduce package size. ([#109](https://github.com/chimurai/http-proxy-middleware/pull/109))
## [v0.17.1](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.17.1)
- fix(Express sub Router): 404 on non-proxy routes ([#94](https://github.com/chimurai/http-proxy-middleware/issues/94))
## [v0.17.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.17.0)
- fix(context matching): Use [RFC 3986 path](https://tools.ietf.org/html/rfc3986#section-3.3) in context matching. (excludes query parameters)
## [v0.16.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.16.0)
- deprecated(proxyTable): renamed `proxyTable` to `router`.
- feat(router): support for custom `router` function.
## [v0.15.2](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.15.2)
- fix(websocket): fixes websocket upgrade.
## [v0.15.1](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.15.1)
- feat(pathRewrite): expose `req` object to pathRewrite function.
- fix(websocket): fixes websocket upgrade when both config.ws and external .upgrade() are used.
## [v0.15.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.15.0)
- feat(pathRewrite): support for custom pathRewrite function.
## [v0.14.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.14.0)
- feat(proxy): support proxy creation without context.
- fix(connect mounting): use connect's `path` configuration to mount proxy.
## [v0.13.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.13.0)
- feat(context): custom context matcher; when simple `path` matching is not sufficient.
## [v0.12.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.12.0)
- add option `onProxyReqWs` (subscribe to http-proxy `proxyReqWs` event)
- add option `onOpen` (subscribe to http-proxy `open` event)
- add option `onClose` (subscribe to http-proxy `close` event)
## [v0.11.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.11.0)
- improved logging
## [v0.10.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.10.0)
- feat(proxyTable) - added proxyTable support for WebSockets.
- fixed(proxyTable) - ensure original path (not rewritten path) is being used when `proxyTable` is used in conjunction with `pathRewrite`.
## [v0.9.1](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.9.1)
- fix server crash when socket error not handled correctly.
## [v0.9.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.9.0)
- support subscribing to http-proxy `proxyReq` event ([trbngr](https://github.com/trbngr))
- add `logLevel` and `logProvider` support
## [v0.8.2](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.8.2)
- fix proxyError handler ([mTazelaar](https://github.com/mTazelaar))
## [v0.8.1](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.8.1)
- fix pathRewrite when `agent` is configured
## [v0.8.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.8.0)
- support external websocket upgrade
- fix websocket shorthand
## [v0.7.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.7.0)
- support shorthand syntax
- fix express/connect mounting
## [v0.6.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.6.0)
- support proxyTable
## [v0.5.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.5.0)
- support subscribing to http-proxy `error` event
- support subscribing to http-proxy `proxyRes` event
## [v0.4.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.4.0)
- support websocket
## [v0.3.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.3.0)
- support wildcard / glob
## [v0.2.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.2.0)
- support multiple paths
## [v0.1.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.1.0)
- support path rewrite
- deprecate proxyHost option
## [v0.0.5](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.0.5)
- initial release

22
node_modules/http-proxy-middleware/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Steven Chim
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.

447
node_modules/http-proxy-middleware/README.md generated vendored Normal file
View File

@@ -0,0 +1,447 @@
# http-proxy-middleware
[![Build Status](https://img.shields.io/travis/chimurai/http-proxy-middleware/master.svg?style=flat-square)](https://travis-ci.org/chimurai/http-proxy-middleware)
[![Coveralls](https://img.shields.io/coveralls/chimurai/http-proxy-middleware.svg?style=flat-square)](https://coveralls.io/r/chimurai/http-proxy-middleware)
[![dependency Status](https://img.shields.io/david/chimurai/http-proxy-middleware.svg?style=flat-square)](https://david-dm.org/chimurai/http-proxy-middleware#info=dependencies)
[![dependency Status](https://snyk.io/test/npm/http-proxy-middleware/badge.svg)](https://snyk.io/test/npm/http-proxy-middleware)
Node.js proxying made simple. Configure proxy middleware with ease for [connect](https://github.com/senchalabs/connect), [express](https://github.com/strongloop/express), [browser-sync](https://github.com/BrowserSync/browser-sync) and [many more](#compatible-servers).
Powered by the popular Nodejitsu [`http-proxy`](https://github.com/nodejitsu/node-http-proxy). [![GitHub stars](https://img.shields.io/github/stars/nodejitsu/node-http-proxy.svg?style=social&label=Star)](https://github.com/nodejitsu/node-http-proxy)
## TL;DR
Proxy `/api` requests to `http://www.example.org`
```javascript
var express = require('express');
var proxy = require('http-proxy-middleware');
var app = express();
app.use('/api', proxy({target: 'http://www.example.org', changeOrigin: true}));
app.listen(3000);
// http://localhost:3000/api/foo/bar -> http://www.example.org/api/foo/bar
```
_All_ `http-proxy` [options](https://github.com/nodejitsu/node-http-proxy#options) can be used, along with some extra `http-proxy-middleware` [options](#options).
:bulb: **Tip:** Set the option `changeOrigin` to `true` for [name-based virtual hosted sites](http://en.wikipedia.org/wiki/Virtual_hosting#Name-based).
## Table of Contents
<!-- MarkdownTOC autolink=true bracket=round depth=2 -->
- [Install](#install)
- [Core concept](#core-concept)
- [Example](#example)
- [Context matching](#context-matching)
- [Options](#options)
- [http-proxy-middleware options](#http-proxy-middleware-options)
- [http-proxy events](#http-proxy-events)
- [http-proxy options](#http-proxy-options)
- [Shorthand](#shorthand)
- [app.use\(path, proxy\)](#appusepath-proxy)
- [WebSocket](#websocket)
- [External WebSocket upgrade](#external-websocket-upgrade)
- [Working examples](#working-examples)
- [Recipes](#recipes)
- [Compatible servers](#compatible-servers)
- [Tests](#tests)
- [Changelog](#changelog)
- [License](#license)
<!-- /MarkdownTOC -->
## Install
```javascript
$ npm install --save-dev http-proxy-middleware
```
## Core concept
Proxy middleware configuration.
#### proxy([context,] config)
```javascript
var proxy = require('http-proxy-middleware');
var apiProxy = proxy('/api', {target: 'http://www.example.org'});
// \____/ \_____________________________/
// | |
// context options
// 'apiProxy' is now ready to be used as middleware in a server.
```
* **context**: Determine which requests should be proxied to the target host.
(more on [context matching](#context-matching))
* **options.target**: target host to proxy to. _(protocol + host)_
(full list of [`http-proxy-middleware` configuration options](#options))
#### proxy(uri [, config])
``` javascript
// shorthand syntax for the example above:
var apiProxy = proxy('http://www.example.org/api');
```
More about the [shorthand configuration](#shorthand).
## Example
An example with `express` server.
```javascript
// include dependencies
var express = require('express');
var proxy = require('http-proxy-middleware');
// proxy middleware options
var options = {
target: 'http://www.example.org', // target host
changeOrigin: true, // needed for virtual hosted sites
ws: true, // proxy websockets
pathRewrite: {
'^/api/old-path' : '/api/new-path', // rewrite path
'^/api/remove/path' : '/path' // remove base path
},
router: {
// when request.headers.host == 'dev.localhost:3000',
// override target 'http://www.example.org' to 'http://localhost:8000'
'dev.localhost:3000' : 'http://localhost:8000'
}
};
// create the proxy (without context)
var exampleProxy = proxy(options);
// mount `exampleProxy` in web server
var app = express();
app.use('/api', exampleProxy);
app.listen(3000);
```
## Context matching
Providing an alternative way to decide which requests should be proxied; In case you are not able to use the server's [`path` parameter](http://expressjs.com/en/4x/api.html#app.use) to mount the proxy or when you need more flexibility.
The [RFC 3986 `path`](https://tools.ietf.org/html/rfc3986#section-3.3) is be used for context matching.
```
foo://example.com:8042/over/there?name=ferret#nose
\_/ \______________/\_________/ \_________/ \__/
| | | | |
scheme authority path query fragment
```
* **path matching**
- `proxy({...})` - matches any path, all requests will be proxied.
- `proxy('/', {...})` - matches any path, all requests will be proxied.
- `proxy('/api', {...})` - matches paths starting with `/api`
* **multiple path matching**
- `proxy(['/api', '/ajax', '/someotherpath'], {...})`
* **wildcard path matching**
For fine-grained control you can use wildcard matching. Glob pattern matching is done by _micromatch_. Visit [micromatch](https://www.npmjs.com/package/micromatch) or [glob](https://www.npmjs.com/package/glob) for more globbing examples.
- `proxy('**', {...})` matches any path, all requests will be proxied.
- `proxy('**/*.html', {...})` matches any path which ends with `.html`
- `proxy('/*.html', {...})` matches paths directly under path-absolute
- `proxy('/api/**/*.html', {...})` matches requests ending with `.html` in the path of `/api`
- `proxy(['/api/**', '/ajax/**'], {...})` combine multiple patterns
- `proxy(['/api/**', '!**/bad.json'], {...})` exclusion
* **custom matching**
For full control you can provide a custom function to determine which requests should be proxied or not.
```javascript
/**
* @return {Boolean}
*/
var filter = function (pathname, req) {
return (pathname.match('^/api') && req.method === 'GET');
};
var apiProxy = proxy(filter, {target: 'http://www.example.org'})
```
## Options
### http-proxy-middleware options
* **option.pathRewrite**: object/function, rewrite target's url path. Object-keys will be used as _RegExp_ to match paths.
```javascript
// rewrite path
pathRewrite: {'^/old/api' : '/new/api'}
// remove path
pathRewrite: {'^/remove/api' : ''}
// add base path
pathRewrite: {'^/' : '/basepath/'}
// custom rewriting
pathRewrite: function (path, req) { return path.replace('/api', '/base/api') }
```
* **option.router**: object/function, re-target `option.target` for specific requests.
```javascript
// Use `host` and/or `path` to match requests. First match will be used.
// The order of the configuration matters.
router: {
'integration.localhost:3000' : 'http://localhost:8001', // host only
'staging.localhost:3000' : 'http://localhost:8002', // host only
'localhost:3000/api' : 'http://localhost:8003', // host + path
'/rest' : 'http://localhost:8004' // path only
}
// Custom router function
router: function(req) {
return 'http://localhost:8004';
}
```
* **option.logLevel**: string, ['debug', 'info', 'warn', 'error', 'silent']. Default: `'info'`
* **option.logProvider**: function, modify or replace log provider. Default: `console`.
```javascript
// simple replace
function logProvider(provider) {
// replace the default console log provider.
return require('winston');
}
```
```javascript
// verbose replacement
function logProvider(provider) {
var logger = new (require('winston').Logger)();
var myCustomProvider = {
log: logger.log,
debug: logger.debug,
info: logger.info,
warn: logger.warn,
error: logger.error
}
return myCustomProvider;
}
```
* (DEPRECATED) **option.proxyHost**: Use `option.changeOrigin = true` instead.
* (DEPRECATED) **option.proxyTable**: Use `option.router` instead.
### http-proxy events
Subscribe to [http-proxy events](https://github.com/nodejitsu/node-http-proxy#listening-for-proxy-events):
* **option.onError**: function, subscribe to http-proxy's `error` event for custom error handling.
```javascript
function onError(err, req, res) {
res.writeHead(500, {
'Content-Type': 'text/plain'
});
res.end('Something went wrong. And we are reporting a custom error message.');
}
```
* **option.onProxyRes**: function, subscribe to http-proxy's `proxyRes` event.
```javascript
function onProxyRes(proxyRes, req, res) {
proxyRes.headers['x-added'] = 'foobar'; // add new header to response
delete proxyRes.headers['x-removed']; // remove header from response
}
```
* **option.onProxyReq**: function, subscribe to http-proxy's `proxyReq` event.
```javascript
function onProxyReq(proxyReq, req, res) {
// add custom header to request
proxyReq.setHeader('x-added', 'foobar');
// or log the req
}
```
* **option.onProxyReqWs**: function, subscribe to http-proxy's `proxyReqWs` event.
```javascript
function onProxyReqWs(proxyReq, req, socket, options, head) {
// add custom header
proxyReq.setHeader('X-Special-Proxy-Header', 'foobar');
}
```
* **option.onOpen**: function, subscribe to http-proxy's `open` event.
```javascript
function onOpen(proxySocket) {
// listen for messages coming FROM the target here
proxySocket.on('data', hybiParseAndLogMessage);
}
```
* **option.onClose**: function, subscribe to http-proxy's `close` event.
```javascript
function onClose(res, socket, head) {
// view disconnected websocket connections
console.log('Client disconnected');
}
```
### http-proxy options
The following options are provided by the underlying [http-proxy](https://github.com/nodejitsu/node-http-proxy#options) library.
* **option.target**: url string to be parsed with the url module
* **option.forward**: url string to be parsed with the url module
* **option.agent**: object to be passed to http(s).request (see Node's [https agent](http://nodejs.org/api/https.html#https_class_https_agent) and [http agent](http://nodejs.org/api/http.html#http_class_http_agent) objects)
* **option.ssl**: object to be passed to https.createServer()
* **option.ws**: true/false: if you want to proxy websockets
* **option.xfwd**: true/false, adds x-forward headers
* **option.secure**: true/false, if you want to verify the SSL Certs
* **option.toProxy**: true/false, passes the absolute URL as the `path` (useful for proxying to proxies)
* **option.prependPath**: true/false, Default: true - specify whether you want to prepend the target's path to the proxy path
* **option.ignorePath**: true/false, Default: false - specify whether you want to ignore the proxy path of the incoming request (note: you will have to append / manually if required).
* **option.localAddress** : Local interface string to bind for outgoing connections
* **option.changeOrigin**: true/false, Default: false - changes the origin of the host header to the target URL
* **option.auth** : Basic authentication i.e. 'user:password' to compute an Authorization header.
* **option.hostRewrite**: rewrites the location hostname on (301/302/307/308) redirects.
* **option.autoRewrite**: rewrites the location host/port on (301/302/307/308) redirects based on requested host/port. Default: false.
* **option.protocolRewrite**: rewrites the location protocol on (301/302/307/308) redirects to 'http' or 'https'. Default: null.
* **option.cookieDomainRewrite**: rewrites domain of `set-cookie` headers. Possible values:
* `false` (default): disable cookie rewriting
* String: new domain, for example `cookieDomainRewrite: "new.domain"`. To remove the domain, use `cookieDomainRewrite: ""`.
* Object: mapping of domains to new domains, use `"*"` to match all domains.
For example keep one domain unchanged, rewrite one domain and remove other domains:
```
cookieDomainRewrite: {
"unchanged.domain": "unchanged.domain",
"old.domain": "new.domain",
"*": ""
}
```
* **option.headers**: object, adds [request headers](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields). (Example: `{host:'www.example.org'}`)
* **option.proxyTimeout**: timeout (in millis) when proxy receives no response from target
## Shorthand
Use the shorthand syntax when verbose configuration is not needed. The `context` and `option.target` will be automatically configured when shorthand is used. Options can still be used if needed.
```javascript
proxy('http://www.example.org:8000/api');
// proxy('/api', {target: 'http://www.example.org:8000'});
proxy('http://www.example.org:8000/api/books/*/**.json');
// proxy('/api/books/*/**.json', {target: 'http://www.example.org:8000'});
proxy('http://www.example.org:8000/api', {changeOrigin:true});
// proxy('/api', {target: 'http://www.example.org:8000', changeOrigin: true});
```
### app.use(path, proxy)
If you want to use the server's `app.use` `path` parameter to match requests;
Create and mount the proxy without the http-proxy-middleware `context` parameter:
```javascript
app.use('/api', proxy({target:'http://www.example.org', changeOrigin:true}));
```
`app.use` documentation:
* express: http://expressjs.com/en/4x/api.html#app.use
* connect: https://github.com/senchalabs/connect#mount-middleware
## WebSocket
```javascript
// verbose api
proxy('/', {target:'http://echo.websocket.org', ws:true});
// shorthand
proxy('http://echo.websocket.org', {ws:true});
// shorter shorthand
proxy('ws://echo.websocket.org');
```
### External WebSocket upgrade
In the previous WebSocket examples, http-proxy-middleware relies on a initial http request in order to listen to the http `upgrade` event. If you need to proxy WebSockets without the initial http request, you can subscribe to the server's http `upgrade` event manually.
```javascript
var wsProxy = proxy('ws://echo.websocket.org', {changeOrigin:true});
var app = express();
app.use(wsProxy);
var server = app.listen(3000);
server.on('upgrade', wsProxy.upgrade); // <-- subscribe to http 'upgrade'
```
## Working examples
View and play around with [working examples](https://github.com/chimurai/http-proxy-middleware/tree/master/examples).
* Browser-Sync ([example source](https://github.com/chimurai/http-proxy-middleware/tree/master/examples/browser-sync/index.js))
* express ([example source](https://github.com/chimurai/http-proxy-middleware/tree/master/examples/express/index.js))
* connect ([example source](https://github.com/chimurai/http-proxy-middleware/tree/master/examples/connect/index.js))
* WebSocket ([example source](https://github.com/chimurai/http-proxy-middleware/tree/master/examples/websocket/index.js))
## Recipes
View the [recipes](https://github.com/chimurai/http-proxy-middleware/tree/master/recipes) for common use cases.
## Compatible servers
`http-proxy-middleware` is compatible with the following servers:
* [connect](https://www.npmjs.com/package/connect)
* [express](https://www.npmjs.com/package/express)
* [browser-sync](https://www.npmjs.com/package/browser-sync)
* [lite-server](https://www.npmjs.com/package/lite-server)
* [grunt-contrib-connect](https://www.npmjs.com/package/grunt-contrib-connect)
* [grunt-browser-sync](https://www.npmjs.com/package/grunt-browser-sync)
* [gulp-connect](https://www.npmjs.com/package/gulp-connect)
* [gulp-webserver](https://www.npmjs.com/package/gulp-webserver)
Sample implementations can be found in the [server recipes](https://github.com/chimurai/http-proxy-middleware/tree/master/recipes/servers.md).
## Tests
Run the test suite:
```bash
# install dependencies
$ npm install
```
unit testing
```bash
# unit tests
$ npm test
```
coverage
```bash
# code coverage
$ npm run cover
```
## Changelog
- [View changelog](https://github.com/chimurai/http-proxy-middleware/blob/master/CHANGELOG.md)
## License
The MIT License (MIT)
Copyright (c) 2015-2017 Steven Chim

5
node_modules/http-proxy-middleware/index.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
var HPM = require('./lib');
module.exports = function(context, opts) {
return new HPM(context, opts);
};

View File

@@ -0,0 +1,126 @@
var _ = require('lodash');
var url = require('url');
var logger = require('./logger').getInstance();
module.exports = {
createConfig: createConfig
};
function createConfig(context, opts) {
// structure of config object to be returned
var config = {
context: undefined,
options: {}
};
// app.use('/api', proxy({target:'http://localhost:9000'}));
if (isContextless(context, opts)) {
config.context = '/';
config.options = _.assign(config.options, context);
}
// app.use('/api', proxy('http://localhost:9000'));
// app.use(proxy('http://localhost:9000/api'));
else if (isStringShortHand(context)) {
var oUrl = url.parse(context);
var target = [oUrl.protocol, '//', oUrl.host].join('');
config.context = oUrl.pathname || '/';
config.options = _.assign(config.options, {target: target}, opts);
if (oUrl.protocol === 'ws:' || oUrl.protocol === 'wss:') {
config.options.ws = true;
}
// app.use('/api', proxy({target:'http://localhost:9000'}));
} else {
config.context = context;
config.options = _.assign(config.options, opts);
}
configureLogger(config.options);
if (!config.options.target) {
throw new Error('[HPM] Missing "target" option. Example: {target: "http://www.example.org"}');
}
// Legacy option.proxyHost
config.options = mapLegacyProxyHostOption(config.options);
// Legacy option.proxyTable > option.router
config.options = mapLegacyProxyTableOption(config.options);
return config;
}
/**
* Checks if a String only target/config is provided.
* This can be just the host or with the optional path.
*
* @example
* app.use('/api', proxy('http://localhost:9000'));
app.use(proxy('http://localhost:9000/api'));
*
* @param {String} context [description]
* @return {Boolean} [description]
*/
function isStringShortHand(context) {
if (_.isString(context)) {
return (url.parse(context).host) ? true : false;
}
}
/**
* Checks if a Object only config is provided, without a context.
* In this case the all paths will be proxied.
*
* @example
* app.use('/api', proxy({target:'http://localhost:9000'}));
*
* @param {Object} context [description]
* @param {*} opts [description]
* @return {Boolean} [description]
*/
function isContextless(context, opts) {
return (_.isPlainObject(context) && _.isEmpty(opts));
}
function mapLegacyProxyHostOption(options) {
// set options.headers.host when option.proxyHost is provided
if (options.proxyHost) {
logger.warn('*************************************');
logger.warn('[HPM] Deprecated "option.proxyHost"');
logger.warn(' Use "option.changeOrigin" or "option.headers.host" instead');
logger.warn(' "option.proxyHost" will be removed in future release.');
logger.warn('*************************************');
options.headers = options.headers || {};
options.headers.host = options.proxyHost;
}
return options;
}
// Warn deprecated proxyTable api usage
function mapLegacyProxyTableOption(options) {
if (options.proxyTable) {
logger.warn('*************************************');
logger.warn('[HPM] Deprecated "option.proxyTable"');
logger.warn(' Use "option.router" instead');
logger.warn(' "option.proxyTable" will be removed in future release.');
logger.warn('*************************************');
options.router = _.clone(options.proxyTable);
_.omit(options, 'proxyTable');
}
return options;
}
function configureLogger(options) {
if (options.logLevel) {
logger.setLevel(options.logLevel);
}
if (options.logProvider) {
logger.setProvider(options.logProvider);
}
}

View File

@@ -0,0 +1,94 @@
var _ = require('lodash');
var url = require('url');
var isGlob = require('is-glob');
var micromatch = require('micromatch');
module.exports = {
match: matchContext
};
function matchContext(context, uri, req) {
// single path
if (isStringPath(context)) {
return matchSingleStringPath(context, uri);
}
// single glob path
if (isGlobPath(context)) {
return matchSingleGlobPath(context, uri);
}
// multi path
if (Array.isArray(context)) {
if (context.every(isStringPath)) {
return matchMultiPath(context, uri);
}
if (context.every(isGlobPath)) {
return matchMultiGlobPath(context, uri);
}
throw new Error('[HPM] Invalid context. Expecting something like: ["/api", "/ajax"] or ["/api/**", "!**.html"]');
}
// custom matching
if (_.isFunction(context)) {
var pathname = getUrlPathName(uri);
return context(pathname, req);
}
throw new Error('[HPM] Invalid context. Expecting something like: "/api" or ["/api", "/ajax"]');
}
/**
* @param {String} context '/api'
* @param {String} uri 'http://example.org/api/b/c/d.html'
* @return {Boolean}
*/
function matchSingleStringPath(context, uri) {
var pathname = getUrlPathName(uri);
return pathname.indexOf(context) === 0;
}
function matchSingleGlobPath(pattern, uri) {
var pathname = getUrlPathName(uri);
var matches = micromatch(pathname, pattern);
return matches && (matches.length > 0);
}
function matchMultiGlobPath(patternList, uri) {
return matchSingleGlobPath(patternList, uri);
}
/**
* @param {String} context ['/api', '/ajax']
* @param {String} uri 'http://example.org/api/b/c/d.html'
* @return {Boolean}
*/
function matchMultiPath(contextList, uri) {
for (var i = 0; i < contextList.length; i++) {
var context = contextList[i];
if (matchSingleStringPath(context, uri)) {
return true;
}
}
return false;
}
/**
* Parses URI and returns RFC 3986 path
*
* @param {String} uri from req.url
* @return {String} RFC 3986 path
*/
function getUrlPathName(uri) {
return uri && url.parse(uri).pathname;
}
function isStringPath(context) {
return _.isString(context) && !isGlob(context);
}
function isGlobPath(context) {
return isGlob(context);
}

74
node_modules/http-proxy-middleware/lib/handlers.js generated vendored Normal file
View File

@@ -0,0 +1,74 @@
var _ = require('lodash');
var logger = require('./logger').getInstance();
module.exports = {
init: init,
getHandlers: getProxyEventHandlers
};
function init(proxy, opts) {
var handlers = getProxyEventHandlers(opts);
_.forIn(handlers, function(handler, eventName) {
proxy.on(eventName, handlers[eventName]);
});
logger.debug('[HPM] Subscribed to http-proxy events: ', _.keys(handlers));
}
function getProxyEventHandlers(opts) {
// https://github.com/nodejitsu/node-http-proxy#listening-for-proxy-events
var proxyEvents = ['error', 'proxyReq', 'proxyReqWs', 'proxyRes', 'open', 'close'];
var handlers = {};
_.forEach(proxyEvents, function(event) {
// all handlers for the http-proxy events are prefixed with 'on'.
// loop through options and try to find these handlers
// and add them to the handlers object for subscription in init().
var eventName = _.camelCase('on ' + event);
var fnHandler = _.get(opts, eventName);
if (_.isFunction(fnHandler)) {
handlers[event] = fnHandler;
}
});
// add default error handler in absence of error handler
if (!_.isFunction(handlers.error)) {
handlers.error = defaultErrorHandler;
}
// add default close handler in absence of close handler
if (!_.isFunction(handlers.close)) {
handlers.close = logClose;
}
return handlers;
};
function defaultErrorHandler(err, req, res) {
var host = (req.headers && req.headers.host);
var code = err.code;
if (res.writeHead && !res.headersSent) {
if (/HPE_INVALID/.test(code)) {
res.writeHead(502);
} else {
switch(code) {
case 'ECONNRESET':
case 'ENOTFOUND':
case 'ECONNREFUSED':
res.writeHead(504);
break;
default: res.writeHead(500);
}
}
}
res.end('Error occured while trying to proxy to: ' + host + req.url);
}
function logClose(req, socket, head) {
// view disconnected websocket connections
logger.info('[HPM] Client disconnected');
}

147
node_modules/http-proxy-middleware/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,147 @@
var _ = require('lodash');
var httpProxy = require('http-proxy');
var configFactory = require('./config-factory');
var handlers = require('./handlers');
var contextMatcher = require('./context-matcher');
var PathRewriter = require('./path-rewriter');
var Router = require('./router');
var logger = require('./logger').getInstance();
var getArrow = require('./logger').getArrow;
module.exports = HttpProxyMiddleware;
function HttpProxyMiddleware(context, opts) {
// https://github.com/chimurai/http-proxy-middleware/issues/57
var wsUpgradeDebounced = _.debounce(handleUpgrade);
var wsInitialized = false;
var config = configFactory.createConfig(context, opts);
var proxyOptions = config.options;
// create proxy
var proxy = httpProxy.createProxyServer({});
logger.info('[HPM] Proxy created:', config.context, ' -> ', proxyOptions.target);
var pathRewriter = PathRewriter.create(proxyOptions.pathRewrite); // returns undefined when "pathRewrite" is not provided
// attach handler to http-proxy events
handlers.init(proxy, proxyOptions);
// log errors for debug purpose
proxy.on('error', logError);
// https://github.com/chimurai/http-proxy-middleware/issues/19
// expose function to upgrade externally
middleware.upgrade = wsUpgradeDebounced;
return middleware;
function middleware(req, res, next) {
if (shouldProxy(config.context, req)) {
var activeProxyOptions = prepareProxyRequest(req);
proxy.web(req, res, activeProxyOptions);
} else {
next();
}
if (proxyOptions.ws === true) {
// use initial request to access the server object to subscribe to http upgrade event
catchUpgradeRequest(req.connection.server);
}
}
function catchUpgradeRequest(server) {
// subscribe once; don't subscribe on every request...
// https://github.com/chimurai/http-proxy-middleware/issues/113
if (!wsInitialized) {
server.on('upgrade', wsUpgradeDebounced);
wsInitialized = true;
}
}
function handleUpgrade(req, socket, head) {
// set to initialized when used externally
wsInitialized = true;
if (shouldProxy(config.context, req)) {
var activeProxyOptions = prepareProxyRequest(req);
proxy.ws(req, socket, head, activeProxyOptions);
logger.info('[HPM] Upgrading to WebSocket');
}
}
/**
* Determine whether request should be proxied.
*
* @private
* @return {Boolean}
*/
function shouldProxy(context, req) {
var path = (req.originalUrl || req.url);
return contextMatcher.match(context, path, req);
}
/**
* Apply option.router and option.pathRewrite
* Order matters:
Router uses original path for routing;
NOT the modified path, after it has been rewritten by pathRewrite
*/
function prepareProxyRequest(req) {
// https://github.com/chimurai/http-proxy-middleware/issues/17
// https://github.com/chimurai/http-proxy-middleware/issues/94
req.url = (req.originalUrl || req.url);
// store uri before it gets rewritten for logging
var originalPath = req.url;
var newProxyOptions = _.assign({}, proxyOptions);
// Apply in order:
// 1. option.router
// 2. option.pathRewrite
__applyRouter(req, newProxyOptions);
__applyPathRewrite(req, pathRewriter);
// debug logging for both http(s) and websockets
if (proxyOptions.logLevel === 'debug') {
var arrow = getArrow(originalPath, req.url, proxyOptions.target, newProxyOptions.target);
logger.debug('[HPM] %s %s %s %s', req.method, originalPath, arrow, newProxyOptions.target);
}
return newProxyOptions;
}
// Modify option.target when router present.
function __applyRouter(req, options) {
var newTarget;
if (options.router) {
newTarget = Router.getTarget(req, options);
if (newTarget) {
logger.debug('[HPM] Router new target: %s -> "%s"', options.target, newTarget);
options.target = newTarget;
}
}
}
// rewrite path
function __applyPathRewrite(req, pathRewriter) {
if (pathRewriter) {
var path = pathRewriter(req.url, req);
if (typeof path === 'string') {
req.url = path;
} else {
logger.info('[HPM] pathRewrite: No rewritten path found. (%s)', req.url);
}
}
}
function logError(err, req, res) {
var hostname = (req.headers && req.headers.host) || (req.hostname || req.host); // (websocket) || (node0.10 || node 4/5)
var target = proxyOptions.target.host || proxyOptions.target;
var errReference = 'https://nodejs.org/api/errors.html#errors_common_system_errors'; // link to Node Common Systems Errors page
logger.error('[HPM] Error occurred while trying to proxy request %s from %s to %s (%s) (%s)', req.url, hostname, target, err.code, errReference);
}
};

158
node_modules/http-proxy-middleware/lib/logger.js generated vendored Normal file
View File

@@ -0,0 +1,158 @@
var util = require('util');
var _ = require('lodash');
var loggerInstance;
var defaultProvider = {
log: console.log,
debug: console.log, // use .log(); since console does not have .debug()
info: console.info,
warn: console.warn,
error: console.error
};
// log level 'weight'
var LEVELS = {
debug: 10,
info: 20,
warn: 30,
error: 50,
silent: 80
};
module.exports = {
// singleton
getInstance: function() {
if (!loggerInstance) {
loggerInstance = new Logger();
}
return loggerInstance;
},
getArrow: getArrow
};
function Logger() {
var logLevel;
var provider;
var api = {
log: log,
debug: debug,
info: info,
warn: warn,
error: error,
setLevel: function(v) {
if (isValidLevel(v)) {
logLevel = v;
}
},
setProvider: function(fn) {
if (fn && isValidProvider(fn)) {
provider = fn(defaultProvider);
}
}
};
init();
return api;
function init() {
api.setLevel('info');
api.setProvider(function() {
return defaultProvider;
});
}
// log will log messages, regardless of logLevels
function log() {
provider.log(_interpolate.apply(null, arguments));
}
function debug() {
if (_showLevel('debug')) {
provider.debug(_interpolate.apply(null, arguments));
}
}
function info() {
if (_showLevel('info')) {
provider.info(_interpolate.apply(null, arguments));
}
}
function warn() {
if (_showLevel('warn')) {
provider.warn(_interpolate.apply(null, arguments));
}
}
function error() {
if (_showLevel('error')) {
provider.error(_interpolate.apply(null, arguments));
}
}
/**
* Decide to log or not to log, based on the log levels 'weight'
* @param {String} showLevel [debug, info, warn, error, silent]
* @return {Boolean}
*/
function _showLevel(showLevel) {
var result = false;
var currentLogLevel = LEVELS[logLevel];
if (currentLogLevel && (currentLogLevel <= LEVELS[showLevel])) {
result = true;
}
return result;
}
// make sure logged messages and its data are return interpolated
// make it possible for additional log data, such date/time or custom prefix.
function _interpolate() {
var fn = _.spread(util.format);
var result = fn(_.slice(arguments));
return result;
}
function isValidProvider(fnProvider) {
var result = true;
if (fnProvider && !_.isFunction(fnProvider)) {
throw new Error('[HPM] Log provider config error. Expecting a function.');
}
return result;
}
function isValidLevel(levelName) {
var validLevels = _.keys(LEVELS);
var isValid = _.includes(validLevels, levelName);
if (!isValid) {
throw new Error('[HPM] Log level error. Invalid logLevel.');
}
return isValid;
}
}
/**
* -> normal proxy
* => router
* ~> pathRewrite
* ≈> router + pathRewrite
*/
function getArrow(originalPath, newPath, originalTarget, newTarget) {
var arrow = ['>'];
var isNewTarget = (originalTarget !== newTarget); // router
var isNewPath = (originalPath !== newPath); // pathRewrite
if (isNewPath && !isNewTarget) {arrow.unshift('~');} else if (!isNewPath && isNewTarget) {arrow.unshift('=');} else if (isNewPath && isNewTarget) {arrow.unshift('≈');} else {arrow.unshift('-');}
return arrow.join('');
}

View File

@@ -0,0 +1,72 @@
var _ = require('lodash');
var logger = require('./logger').getInstance();
module.exports = {
create: createPathRewriter
};
/**
* Create rewrite function, to cache parsed rewrite rules.
*
* @returns {function} Function to rewrite paths; This function should accept `path` (request.url) as parameter
*/
function createPathRewriter(rewriteConfig) {
var rulesCache;
if (!isValidRewriteConfig(rewriteConfig)) {
return;
}
if (_.isFunction(rewriteConfig)) {
var customRewriteFn = rewriteConfig;
return customRewriteFn;
} else {
rulesCache = parsePathRewriteRules(rewriteConfig);
return rewritePath;
}
function rewritePath(path) {
var result = path;
_.forEach(rulesCache, function(rule) {
if (rule.regex.test(path)) {
result = result.replace(rule.regex, rule.value);
logger.debug('[HPM] Rewriting path from "%s" to "%s"', path, result);
return false;
}
});
return result;
}
}
function isValidRewriteConfig(rewriteConfig) {
if (_.isFunction(rewriteConfig)) {
return true;
} else if (!_.isEmpty(rewriteConfig) && _.isPlainObject(rewriteConfig)) {
return true;
} else if (_.isUndefined(rewriteConfig) ||
_.isNull(rewriteConfig) ||
_.isEqual(rewriteConfig, {})) {
return false;
} else {
throw new Error('[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function');
}
}
function parsePathRewriteRules(rewriteConfig) {
var rules = [];
if (_.isPlainObject(rewriteConfig)) {
_.forIn(rewriteConfig, function(value, key) {
rules.push({
regex: new RegExp(key),
value: rewriteConfig[key]
});
logger.info('[HPM] Proxy rewrite rule created: "%s" ~> "%s"', key, rewriteConfig[key]);
});
}
return rules;
}

53
node_modules/http-proxy-middleware/lib/router.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
var _ = require('lodash');
var logger = require('./logger.js').getInstance();
module.exports = {
getTarget: getTarget
};
function getTarget(req, config) {
var newTarget;
var router = config.router;
if (_.isPlainObject(router)) {
newTarget = getTargetFromProxyTable(req, router);
} else if (_.isFunction(router)) {
newTarget = router(req);
}
return newTarget;
}
function getTargetFromProxyTable(req, table) {
var result;
var host = req.headers.host;
var path = req.url;
var hostAndPath = host + path;
_.forIn(table, function(value, key) {
if (containsPath(key)) {
if (hostAndPath.indexOf(key) > -1) { // match 'localhost:3000/api'
result = table[key];
logger.debug('[HPM] Router table match: "%s"', key);
return false;
}
} else {
if (key === host) { // match 'localhost:3000'
result = table[key];
logger.debug('[HPM] Router table match: "%s"', host);
return false;
}
}
});
return result;
}
function containsPath(v) {
return v.indexOf('/') > -1;
}

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2015, 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.

View File

@@ -0,0 +1,74 @@
# arr-diff [![NPM version](https://img.shields.io/npm/v/arr-diff.svg)](https://www.npmjs.com/package/arr-diff) [![Build Status](https://img.shields.io/travis/jonschlinkert/base.svg)](https://travis-ci.org/jonschlinkert/base)
> Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
## Install
Install with [npm](https://www.npmjs.com/)
```sh
$ npm i arr-diff --save
```
Install with [bower](http://bower.io/)
```sh
$ bower install arr-diff --save
```
## API
### [diff](index.js#L33)
Return the difference between the first array and additional arrays.
**Params**
* `a` **{Array}**
* `b` **{Array}**
* `returns` **{Array}**
**Example**
```js
var diff = require('arr-diff');
var a = ['a', 'b', 'c', 'd'];
var b = ['b', 'c'];
console.log(diff(a, b))
//=> ['a', 'd']
```
## Related projects
* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten)
* [array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter)
* [array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://www.npmjs.com/package/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection)
## Running tests
Install dev dependencies:
```sh
$ npm i -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-diff/issues/new).
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the MIT license.
***
_This file was generated by [verb](https://github.com/verbose/verb) on Sat Dec 05 2015 23:24:53 GMT-0500 (EST)._

View File

@@ -0,0 +1,58 @@
/*!
* arr-diff <https://github.com/jonschlinkert/arr-diff>
*
* Copyright (c) 2014 Jon Schlinkert, contributors.
* Licensed under the MIT License
*/
'use strict';
var flatten = require('arr-flatten');
var slice = [].slice;
/**
* Return the difference between the first array and
* additional arrays.
*
* ```js
* var diff = require('{%= name %}');
*
* var a = ['a', 'b', 'c', 'd'];
* var b = ['b', 'c'];
*
* console.log(diff(a, b))
* //=> ['a', 'd']
* ```
*
* @param {Array} `a`
* @param {Array} `b`
* @return {Array}
* @api public
*/
function diff(arr, arrays) {
var argsLen = arguments.length;
var len = arr.length, i = -1;
var res = [], arrays;
if (argsLen === 1) {
return arr;
}
if (argsLen > 2) {
arrays = flatten(slice.call(arguments, 1));
}
while (++i < len) {
if (!~arrays.indexOf(arr[i])) {
res.push(arr[i]);
}
}
return res;
}
/**
* Expose `diff`
*/
module.exports = diff;

View File

@@ -0,0 +1,80 @@
{
"_from": "arr-diff@^2.0.0",
"_id": "arr-diff@2.0.0",
"_inBundle": false,
"_integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=",
"_location": "/http-proxy-middleware/arr-diff",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "arr-diff@^2.0.0",
"name": "arr-diff",
"escapedName": "arr-diff",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/http-proxy-middleware/micromatch"
],
"_resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz",
"_shasum": "8f3b827f955a8bd669697e4a4256ac3ceae356cf",
"_spec": "arr-diff@^2.0.0",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\http-proxy-middleware\\node_modules\\micromatch",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/arr-diff/issues"
},
"bundleDependencies": false,
"dependencies": {
"arr-flatten": "^1.0.1"
},
"deprecated": false,
"description": "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.",
"devDependencies": {
"array-differ": "^1.0.0",
"array-slice": "^0.2.3",
"benchmarked": "^0.1.4",
"chalk": "^1.1.1",
"mocha": "*",
"should": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/arr-diff",
"keywords": [
"arr",
"array",
"diff",
"differ",
"difference"
],
"license": "MIT",
"main": "index.js",
"name": "arr-diff",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/arr-diff.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"related": {
"list": [
"arr-flatten",
"array-filter",
"array-intersection"
]
}
},
"version": "2.0.0"
}

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2015, 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.

View File

@@ -0,0 +1,51 @@
# array-unique [![NPM version](https://badge.fury.io/js/array-unique.svg)](http://badge.fury.io/js/array-unique) [![Build Status](https://travis-ci.org/jonschlinkert/array-unique.svg)](https://travis-ci.org/jonschlinkert/array-unique)
> Return an array free of duplicate values. Fastest ES5 implementation.
## Install with [npm](npmjs.org)
```bash
npm i array-unique --save
```
## Usage
```js
var unique = require('array-unique');
unique(['a', 'b', 'c', 'c']);
//=> ['a', 'b', 'c']
```
## Related
* [arr-diff](https://github.com/jonschlinkert/arr-diff): Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
* [arr-union](https://github.com/jonschlinkert/arr-union): Returns an array of unique values using strict equality for comparisons.
* [arr-flatten](https://github.com/jonschlinkert/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten.
* [arr-reduce](https://github.com/jonschlinkert/arr-reduce): Fast array reduce that also loops over sparse elements.
* [arr-map](https://github.com/jonschlinkert/arr-map): Faster, node.js focused alternative to JavaScript's native array map.
* [arr-pluck](https://github.com/jonschlinkert/arr-pluck): Retrieves the value of a specified property from all elements in the collection.
## Run tests
Install dev dependencies.
```bash
npm i -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/array-unique/issues)
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 24, 2015._

View File

@@ -0,0 +1,28 @@
/*!
* array-unique <https://github.com/jonschlinkert/array-unique>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
module.exports = function unique(arr) {
if (!Array.isArray(arr)) {
throw new TypeError('array-unique expects an array.');
}
var len = arr.length;
var i = -1;
while (i++ < len) {
var j = i + 1;
for (; j < arr.length; ++j) {
if (arr[i] === arr[j]) {
arr.splice(j--, 1);
}
}
}
return arr;
};

View File

@@ -0,0 +1,62 @@
{
"_from": "array-unique@^0.2.1",
"_id": "array-unique@0.2.1",
"_inBundle": false,
"_integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=",
"_location": "/http-proxy-middleware/array-unique",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "array-unique@^0.2.1",
"name": "array-unique",
"escapedName": "array-unique",
"rawSpec": "^0.2.1",
"saveSpec": null,
"fetchSpec": "^0.2.1"
},
"_requiredBy": [
"/http-proxy-middleware/micromatch"
],
"_resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz",
"_shasum": "a1d97ccafcbc2625cc70fadceb36a50c58b01a53",
"_spec": "array-unique@^0.2.1",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\http-proxy-middleware\\node_modules\\micromatch",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/array-unique/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Return an array free of duplicate values. Fastest ES5 implementation.",
"devDependencies": {
"array-uniq": "^1.0.2",
"benchmarked": "^0.1.3",
"mocha": "*",
"should": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/array-unique",
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/array-unique/blob/master/LICENSE"
},
"main": "index.js",
"name": "array-unique",
"repository": {
"type": "git",
"url": "git://github.com/jonschlinkert/array-unique.git"
},
"scripts": {
"test": "mocha"
},
"version": "0.2.1"
}

View File

@@ -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.

View File

@@ -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._

View File

@@ -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;
}

View File

@@ -0,0 +1,114 @@
{
"_from": "braces@^1.8.2",
"_id": "braces@1.8.5",
"_inBundle": false,
"_integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=",
"_location": "/http-proxy-middleware/braces",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "braces@^1.8.2",
"name": "braces",
"escapedName": "braces",
"rawSpec": "^1.8.2",
"saveSpec": null,
"fetchSpec": "^1.8.2"
},
"_requiredBy": [
"/http-proxy-middleware/micromatch"
],
"_resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz",
"_shasum": "ba77962e12dff969d6b76711e914b737857bf6a7",
"_spec": "braces@^1.8.2",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\http-proxy-middleware\\node_modules\\micromatch",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/braces/issues"
},
"bundleDependencies": false,
"dependencies": {
"expand-range": "^1.8.1",
"preserve": "^0.2.0",
"repeat-element": "^1.1.2"
},
"deprecated": false,
"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"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"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",
"name": "braces",
"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"
}

View File

@@ -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.

View File

@@ -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._

View File

@@ -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;
};

View File

@@ -0,0 +1,93 @@
{
"_from": "expand-brackets@^0.1.4",
"_id": "expand-brackets@0.1.5",
"_inBundle": false,
"_integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=",
"_location": "/http-proxy-middleware/expand-brackets",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "expand-brackets@^0.1.4",
"name": "expand-brackets",
"escapedName": "expand-brackets",
"rawSpec": "^0.1.4",
"saveSpec": null,
"fetchSpec": "^0.1.4"
},
"_requiredBy": [
"/http-proxy-middleware/micromatch"
],
"_resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz",
"_shasum": "df07284e342a807cd733ac5af72411e581d1177b",
"_spec": "expand-brackets@^0.1.4",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\http-proxy-middleware\\node_modules\\micromatch",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/expand-brackets/issues"
},
"bundleDependencies": false,
"dependencies": {
"is-posix-bracket": "^0.1.0"
},
"deprecated": false,
"description": "Expand POSIX bracket expressions (character classes) in glob patterns.",
"devDependencies": {
"gulp-format-md": "^0.1.7",
"mocha": "^2.2.5",
"should": "^7.0.2"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/expand-brackets",
"keywords": [
"bracket",
"character class",
"expression",
"posix"
],
"license": "MIT",
"main": "index.js",
"name": "expand-brackets",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/expand-brackets.git"
},
"scripts": {
"test": "mocha"
},
"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
}
},
"version": "0.1.5"
}

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015, 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.

View File

@@ -0,0 +1,88 @@
# extglob [![NPM version](https://badge.fury.io/js/extglob.svg)](http://badge.fury.io/js/extglob) [![Build Status](https://travis-ci.org/jonschlinkert/extglob.svg)](https://travis-ci.org/jonschlinkert/extglob)
> Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to glob patterns.
Install with [npm](https://www.npmjs.com/)
```sh
$ npm i extglob --save
```
Used by [micromatch](https://github.com/jonschlinkert/micromatch).
**Features**
* Convert an extglob string to a regex-compatible string. **Only converts extglobs**, to handle full globs use [micromatch](https://github.com/jonschlinkert/micromatch).
* Pass `{regex: true}` to return a regex
* Handles nested patterns
* More complete (and correct) support than [minimatch](https://github.com/isaacs/minimatch)
## Usage
```js
var extglob = require('extglob');
extglob('?(z)');
//=> '(?:z)?'
extglob('*(z)');
//=> '(?:z)*'
extglob('+(z)');
//=> '(?:z)+'
extglob('@(z)');
//=> '(?:z)'
extglob('!(z)');
//=> '(?!^(?:(?!z)[^/]*?)).*$'
```
**Optionally return regex**
```js
extglob('!(z)', {regex: true});
//=> /(?!^(?:(?!z)[^/]*?)).*$/
```
## Extglob patterns
To learn more about how extglobs work, see the docs for [Bash pattern matching](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html):
* `?(pattern)`: Match zero or one occurrence of the given pattern.
* `*(pattern)`: Match zero or more occurrences of the given pattern.
* `+(pattern)`: Match one or more occurrences of the given pattern.
* `@(pattern)`: Match one of the given pattern.
* `!(pattern)`: Match anything except one of the given pattern.
## Related
* [braces](https://github.com/jonschlinkert/braces): Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces… [more](https://github.com/jonschlinkert/braces)
* [expand-brackets](https://github.com/jonschlinkert/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns.
* [expand-range](https://github.com/jonschlinkert/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See… [more](https://github.com/jonschlinkert/expand-range)
* [fill-range](https://github.com/jonschlinkert/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier to… [more](https://github.com/jonschlinkert/fill-range)
* [micromatch](https://github.com/jonschlinkert/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://github.com/jonschlinkert/micromatch)
## Run tests
Install dev dependencies:
```sh
$ npm i -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/extglob/issues/new)
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright © 2015 Jon Schlinkert
Released under the MIT license.
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 01, 2015._

View File

@@ -0,0 +1,178 @@
/*!
* extglob <https://github.com/jonschlinkert/extglob>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
/**
* Module dependencies
*/
var isExtglob = require('is-extglob');
var re, cache = {};
/**
* Expose `extglob`
*/
module.exports = extglob;
/**
* Convert the given extglob `string` to a regex-compatible
* string.
*
* ```js
* var extglob = require('extglob');
* extglob('!(a?(b))');
* //=> '(?!a(?:b)?)[^/]*?'
* ```
*
* @param {String} `str` The string to convert.
* @param {Object} `options`
* @option {Boolean} [options] `esc` If `false` special characters will not be escaped. Defaults to `true`.
* @option {Boolean} [options] `regex` If `true` a regular expression is returned instead of a string.
* @return {String}
* @api public
*/
function extglob(str, opts) {
opts = opts || {};
var o = {}, i = 0;
// fix common character reversals
// '*!(.js)' => '*.!(js)'
str = str.replace(/!\(([^\w*()])/g, '$1!(');
// support file extension negation
str = str.replace(/([*\/])\.!\([*]\)/g, function (m, ch) {
if (ch === '/') {
return escape('\\/[^.]+');
}
return escape('[^.]+');
});
// create a unique key for caching by
// combining the string and options
var key = str
+ String(!!opts.regex)
+ String(!!opts.contains)
+ String(!!opts.escape);
if (cache.hasOwnProperty(key)) {
return cache[key];
}
if (!(re instanceof RegExp)) {
re = regex();
}
opts.negate = false;
var m;
while (m = re.exec(str)) {
var prefix = m[1];
var inner = m[3];
if (prefix === '!') {
opts.negate = true;
}
var id = '__EXTGLOB_' + (i++) + '__';
// use the prefix of the _last_ (outtermost) pattern
o[id] = wrap(inner, prefix, opts.escape);
str = str.split(m[0]).join(id);
}
var keys = Object.keys(o);
var len = keys.length;
// we have to loop again to allow us to convert
// patterns in reverse order (starting with the
// innermost/last pattern first)
while (len--) {
var prop = keys[len];
str = str.split(prop).join(o[prop]);
}
var result = opts.regex
? toRegex(str, opts.contains, opts.negate)
: str;
result = result.split('.').join('\\.');
// cache the result and return it
return (cache[key] = result);
}
/**
* Convert `string` to a regex string.
*
* @param {String} `str`
* @param {String} `prefix` Character that determines how to wrap the string.
* @param {Boolean} `esc` If `false` special characters will not be escaped. Defaults to `true`.
* @return {String}
*/
function wrap(inner, prefix, esc) {
if (esc) inner = escape(inner);
switch (prefix) {
case '!':
return '(?!' + inner + ')[^/]' + (esc ? '%%%~' : '*?');
case '@':
return '(?:' + inner + ')';
case '+':
return '(?:' + inner + ')+';
case '*':
return '(?:' + inner + ')' + (esc ? '%%' : '*')
case '?':
return '(?:' + inner + '|)';
default:
return inner;
}
}
function escape(str) {
str = str.split('*').join('[^/]%%%~');
str = str.split('.').join('\\.');
return str;
}
/**
* extglob regex.
*/
function regex() {
return /(\\?[@?!+*$]\\?)(\(([^()]*?)\))/;
}
/**
* Negation regex
*/
function negate(str) {
return '(?!^' + str + ').*$';
}
/**
* Create the regex to do the matching. If
* the leading character in the `pattern` is `!`
* a negation regex is returned.
*
* @param {String} `pattern`
* @param {Boolean} `contains` Allow loose matching.
* @param {Boolean} `isNegated` True if the pattern is a negation pattern.
*/
function toRegex(pattern, contains, isNegated) {
var prefix = contains ? '^' : '';
var after = contains ? '$' : '';
pattern = ('(?:' + pattern + ')' + after);
if (isNegated) {
pattern = prefix + negate(pattern);
}
return new RegExp(prefix + pattern);
}

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2015, 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.

View File

@@ -0,0 +1,75 @@
# is-extglob [![NPM version](https://badge.fury.io/js/is-extglob.svg)](http://badge.fury.io/js/is-extglob) [![Build Status](https://travis-ci.org/jonschlinkert/is-extglob.svg)](https://travis-ci.org/jonschlinkert/is-extglob)
> Returns true if a string has an extglob.
## Install with [npm](npmjs.org)
```bash
npm i is-extglob --save
```
## Usage
```js
var isExtglob = require('is-extglob');
```
**True**
```js
isExtglob('?(abc)');
isExtglob('@(abc)');
isExtglob('!(abc)');
isExtglob('*(abc)');
isExtglob('+(abc)');
```
**False**
Everything else...
```js
isExtglob('foo.js');
isExtglob('!foo.js');
isExtglob('*.js');
isExtglob('**/abc.js');
isExtglob('abc/*.js');
isExtglob('abc/(aaa|bbb).js');
isExtglob('abc/[a-z].js');
isExtglob('abc/{a,b}.js');
isExtglob('abc/?.js');
isExtglob('abc.js');
isExtglob('abc/def/ghi.js');
```
## Related
* [extglob](https://github.com/jonschlinkert/extglob): Extended globs. extglobs add the expressive power of regular expressions to glob patterns.
* [micromatch](https://github.com/jonschlinkert/micromatch): Glob matching for javascript/node.js. A faster alternative to minimatch (10-45x faster on avg), with all the features you're used to using in your Grunt and gulp tasks.
* [parse-glob](https://github.com/jonschlinkert/parse-glob): Parse a glob pattern into an object of tokens.
## Run tests
Install dev dependencies.
```bash
npm i -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-extglob/issues)
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 06, 2015._

View File

@@ -0,0 +1,11 @@
/*!
* is-extglob <https://github.com/jonschlinkert/is-extglob>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
module.exports = function isExtglob(str) {
return typeof str === 'string'
&& /[@?!+*]\(/.test(str);
};

View File

@@ -0,0 +1,76 @@
{
"_from": "is-extglob@^1.0.0",
"_id": "is-extglob@1.0.0",
"_inBundle": false,
"_integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=",
"_location": "/http-proxy-middleware/extglob/is-extglob",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "is-extglob@^1.0.0",
"name": "is-extglob",
"escapedName": "is-extglob",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/http-proxy-middleware/extglob"
],
"_resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz",
"_shasum": "ac468177c4943405a092fc8f29760c6ffc6206c0",
"_spec": "is-extglob@^1.0.0",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\http-proxy-middleware\\node_modules\\extglob",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/is-extglob/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Returns true if a string has an extglob.",
"devDependencies": {
"mocha": "*",
"should": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/is-extglob",
"keywords": [
"bash",
"braces",
"check",
"exec",
"extglob",
"expression",
"glob",
"globbing",
"globstar",
"match",
"matches",
"pattern",
"regex",
"regular",
"string",
"test"
],
"license": "MIT",
"main": "index.js",
"name": "is-extglob",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/is-extglob.git"
},
"scripts": {
"prepublish": "browserify -o browser.js -e index.js",
"test": "mocha"
},
"version": "1.0.0"
}

View File

@@ -0,0 +1,85 @@
{
"_from": "extglob@^0.3.1",
"_id": "extglob@0.3.2",
"_inBundle": false,
"_integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=",
"_location": "/http-proxy-middleware/extglob",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "extglob@^0.3.1",
"name": "extglob",
"escapedName": "extglob",
"rawSpec": "^0.3.1",
"saveSpec": null,
"fetchSpec": "^0.3.1"
},
"_requiredBy": [
"/http-proxy-middleware/micromatch"
],
"_resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz",
"_shasum": "2e18ff3d2f49ab2765cec9023f011daa8d8349a1",
"_spec": "extglob@^0.3.1",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\http-proxy-middleware\\node_modules\\micromatch",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/extglob/issues"
},
"bundleDependencies": false,
"dependencies": {
"is-extglob": "^1.0.0"
},
"deprecated": false,
"description": "Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to glob patterns.",
"devDependencies": {
"ansi-green": "^0.1.1",
"micromatch": "^2.1.6",
"minimatch": "^2.0.1",
"minimist": "^1.1.0",
"mocha": "*",
"should": "*",
"success-symbol": "^0.1.0"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/extglob",
"keywords": [
"bash",
"extended",
"extglob",
"glob",
"ksh",
"match",
"wildcard"
],
"license": "MIT",
"main": "index.js",
"name": "extglob",
"repository": {
"type": "git",
"url": "git://github.com/jonschlinkert/extglob.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"related": {
"list": [
"micromatch",
"expand-brackets",
"braces",
"fill-range",
"expand-range"
]
}
},
"version": "0.3.2"
}

View File

@@ -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.

View File

@@ -0,0 +1,142 @@
# is-glob [![NPM version](https://img.shields.io/npm/v/is-glob.svg?style=flat)](https://www.npmjs.com/package/is-glob) [![NPM downloads](https://img.shields.io/npm/dm/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-glob.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-glob)
> Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save is-glob
```
You might also be interested in [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob).
## Usage
```js
var isGlob = require('is-glob');
```
**True**
Patterns that have glob characters or regex patterns will return `true`:
```js
isGlob('!foo.js');
isGlob('*.js');
isGlob('**/abc.js');
isGlob('abc/*.js');
isGlob('abc/(aaa|bbb).js');
isGlob('abc/[a-z].js');
isGlob('abc/{a,b}.js');
isGlob('abc/?.js');
//=> true
```
Extglobs
```js
isGlob('abc/@(a).js');
isGlob('abc/!(a).js');
isGlob('abc/+(a).js');
isGlob('abc/*(a).js');
isGlob('abc/?(a).js');
//=> true
```
**False**
Escaped globs or extglobs return `false`:
```js
isGlob('abc/\\@(a).js');
isGlob('abc/\\!(a).js');
isGlob('abc/\\+(a).js');
isGlob('abc/\\*(a).js');
isGlob('abc/\\?(a).js');
isGlob('\\!foo.js');
isGlob('\\*.js');
isGlob('\\*\\*/abc.js');
isGlob('abc/\\*.js');
isGlob('abc/\\(aaa|bbb).js');
isGlob('abc/\\[a-z].js');
isGlob('abc/\\{a,b}.js');
isGlob('abc/\\?.js');
//=> false
```
Patterns that do not have glob patterns return `false`:
```js
isGlob('abc.js');
isGlob('abc/def/ghi.js');
isGlob('foo.js');
isGlob('abc/@.js');
isGlob('abc/+.js');
isGlob();
isGlob(null);
//=> false
```
Arrays are also `false` (If you want to check if an array has a glob pattern, use [has-glob](https://github.com/jonschlinkert/has-glob)):
```js
isGlob(['**/*.js']);
isGlob(['foo.js']);
//=> false
```
## About
### Related projects
* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit")
* [base](https://www.npmjs.com/package/base): base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… [more](https://github.com/node-base/base) | [homepage](https://github.com/node-base/base "base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting with a handful of common methods, like `set`, `get`, `del` and `use`.")
* [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update "Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.")
* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.")
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Contributors
| **Commits** | **Contributor**<br/> |
| --- | --- |
| 40 | [jonschlinkert](https://github.com/jonschlinkert) |
| 1 | [tuvistavie](https://github.com/tuvistavie) |
### 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).)_
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm install -g verb verb-generate-readme && 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/is-glob/blob/master/LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._

View File

@@ -0,0 +1,25 @@
/*!
* is-glob <https://github.com/jonschlinkert/is-glob>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
var isExtglob = require('is-extglob');
module.exports = function isGlob(str) {
if (typeof str !== 'string' || str === '') {
return false;
}
if (isExtglob(str)) return true;
var regex = /(\\).|([*?]|\[.*\]|\{.*\}|\(.*\|.*\)|^!)/;
var match;
while ((match = regex.exec(str))) {
if (match[2]) return true;
str = str.slice(match.index + match[0].length);
}
return false;
};

View File

@@ -0,0 +1,119 @@
{
"_from": "is-glob@^3.1.0",
"_id": "is-glob@3.1.0",
"_inBundle": false,
"_integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=",
"_location": "/http-proxy-middleware/is-glob",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "is-glob@^3.1.0",
"name": "is-glob",
"escapedName": "is-glob",
"rawSpec": "^3.1.0",
"saveSpec": null,
"fetchSpec": "^3.1.0"
},
"_requiredBy": [
"/http-proxy-middleware"
],
"_resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz",
"_shasum": "7ba5ae24217804ac70707b96922567486cc3e84a",
"_spec": "is-glob@^3.1.0",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\http-proxy-middleware",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/is-glob/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Daniel Perez",
"email": "daniel@claudetech.com",
"url": "http://tuvistavie.com"
},
{
"name": "Jon Schlinkert",
"email": "jon.schlinkert@sellside.com",
"url": "http://twitter.com/jonschlinkert"
}
],
"dependencies": {
"is-extglob": "^2.1.0"
},
"deprecated": false,
"description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.",
"devDependencies": {
"gulp-format-md": "^0.1.10",
"mocha": "^3.0.2"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/is-glob",
"keywords": [
"bash",
"braces",
"check",
"exec",
"expression",
"extglob",
"glob",
"globbing",
"globstar",
"is",
"match",
"matches",
"pattern",
"regex",
"regular",
"string",
"test"
],
"license": "MIT",
"main": "index.js",
"name": "is-glob",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/is-glob.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"layout": "default",
"plugins": [
"gulp-format-md"
],
"related": {
"list": [
"assemble",
"base",
"update",
"verb"
]
},
"reflinks": [
"assemble",
"bach",
"base",
"composer",
"gulp",
"has-glob",
"is-valid-glob",
"micromatch",
"npm",
"scaffold",
"verb",
"vinyl"
]
},
"version": "3.1.0"
}

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2017, 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.

View File

@@ -0,0 +1,261 @@
# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM monthly downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![NPM total downloads](https://img.shields.io/npm/dt/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/kind-of)
> Get the native type of a value.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save kind-of
```
## Install
Install with [bower](https://bower.io/)
```sh
$ bower install kind-of --save
```
## Usage
> es5, browser and es6 ready
```js
var kindOf = require('kind-of');
kindOf(undefined);
//=> 'undefined'
kindOf(null);
//=> 'null'
kindOf(true);
//=> 'boolean'
kindOf(false);
//=> 'boolean'
kindOf(new Boolean(true));
//=> 'boolean'
kindOf(new Buffer(''));
//=> 'buffer'
kindOf(42);
//=> 'number'
kindOf(new Number(42));
//=> 'number'
kindOf('str');
//=> 'string'
kindOf(new String('str'));
//=> 'string'
kindOf(arguments);
//=> 'arguments'
kindOf({});
//=> 'object'
kindOf(Object.create(null));
//=> 'object'
kindOf(new Test());
//=> 'object'
kindOf(new Date());
//=> 'date'
kindOf([]);
//=> 'array'
kindOf([1, 2, 3]);
//=> 'array'
kindOf(new Array());
//=> 'array'
kindOf(/foo/);
//=> 'regexp'
kindOf(new RegExp('foo'));
//=> 'regexp'
kindOf(function () {});
//=> 'function'
kindOf(function * () {});
//=> 'function'
kindOf(new Function());
//=> 'function'
kindOf(new Map());
//=> 'map'
kindOf(new WeakMap());
//=> 'weakmap'
kindOf(new Set());
//=> 'set'
kindOf(new WeakSet());
//=> 'weakset'
kindOf(Symbol('str'));
//=> 'symbol'
kindOf(new Int8Array());
//=> 'int8array'
kindOf(new Uint8Array());
//=> 'uint8array'
kindOf(new Uint8ClampedArray());
//=> 'uint8clampedarray'
kindOf(new Int16Array());
//=> 'int16array'
kindOf(new Uint16Array());
//=> 'uint16array'
kindOf(new Int32Array());
//=> 'int32array'
kindOf(new Uint32Array());
//=> 'uint32array'
kindOf(new Float32Array());
//=> 'float32array'
kindOf(new Float64Array());
//=> 'float64array'
```
## Benchmarks
Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of).
Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`.
```bash
#1: array
current x 23,329,397 ops/sec ±0.82% (94 runs sampled)
lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled)
lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled)
#2: boolean
current x 27,197,115 ops/sec ±0.85% (94 runs sampled)
lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled)
lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled)
#3: date
current x 20,190,117 ops/sec ±0.86% (92 runs sampled)
lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled)
lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled)
#4: function
current x 23,855,460 ops/sec ±0.60% (97 runs sampled)
lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled)
lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled)
#5: null
current x 27,061,047 ops/sec ±0.97% (96 runs sampled)
lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled)
lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled)
#6: number
current x 25,075,682 ops/sec ±0.53% (99 runs sampled)
lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled)
lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled)
#7: object
current x 3,348,980 ops/sec ±0.49% (99 runs sampled)
lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled)
lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled)
#8: regex
current x 21,284,827 ops/sec ±0.72% (96 runs sampled)
lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled)
lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled)
#9: string
current x 25,379,234 ops/sec ±0.58% (96 runs sampled)
lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled)
lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled)
#10: undef
current x 27,459,221 ops/sec ±1.01% (93 runs sampled)
lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled)
lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled)
```
## Optimizations
In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library:
1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot.
2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it.
3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'`
## About
### Related projects
* [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://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.")
* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ")
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 59 | [jonschlinkert](https://github.com/jonschlinkert) |
| 2 | [miguelmota](https://github.com/miguelmota) |
| 1 | [dtothefp](https://github.com/dtothefp) |
| 1 | [ksheedlo](https://github.com/ksheedlo) |
| 1 | [pdehaan](https://github.com/pdehaan) |
| 1 | [laggingreflex](https://github.com/laggingreflex) |
### Building docs
_(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, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
### Running tests
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 && npm test
```
### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
### 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.6.0, on May 16, 2017._

View File

@@ -0,0 +1,116 @@
var isBuffer = require('is-buffer');
var toString = Object.prototype.toString;
/**
* Get the native `typeof` a value.
*
* @param {*} `val`
* @return {*} Native javascript type
*/
module.exports = function kindOf(val) {
// primitivies
if (typeof val === 'undefined') {
return 'undefined';
}
if (val === null) {
return 'null';
}
if (val === true || val === false || val instanceof Boolean) {
return 'boolean';
}
if (typeof val === 'string' || val instanceof String) {
return 'string';
}
if (typeof val === 'number' || val instanceof Number) {
return 'number';
}
// functions
if (typeof val === 'function' || val instanceof Function) {
return 'function';
}
// array
if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
return 'array';
}
// check for instances of RegExp and Date before calling `toString`
if (val instanceof RegExp) {
return 'regexp';
}
if (val instanceof Date) {
return 'date';
}
// other objects
var type = toString.call(val);
if (type === '[object RegExp]') {
return 'regexp';
}
if (type === '[object Date]') {
return 'date';
}
if (type === '[object Arguments]') {
return 'arguments';
}
if (type === '[object Error]') {
return 'error';
}
// buffer
if (isBuffer(val)) {
return 'buffer';
}
// es6: Map, WeakMap, Set, WeakSet
if (type === '[object Set]') {
return 'set';
}
if (type === '[object WeakSet]') {
return 'weakset';
}
if (type === '[object Map]') {
return 'map';
}
if (type === '[object WeakMap]') {
return 'weakmap';
}
if (type === '[object Symbol]') {
return 'symbol';
}
// typed arrays
if (type === '[object Int8Array]') {
return 'int8array';
}
if (type === '[object Uint8Array]') {
return 'uint8array';
}
if (type === '[object Uint8ClampedArray]') {
return 'uint8clampedarray';
}
if (type === '[object Int16Array]') {
return 'int16array';
}
if (type === '[object Uint16Array]') {
return 'uint16array';
}
if (type === '[object Int32Array]') {
return 'int32array';
}
if (type === '[object Uint32Array]') {
return 'uint32array';
}
if (type === '[object Float32Array]') {
return 'float32array';
}
if (type === '[object Float64Array]') {
return 'float64array';
}
// must be a plain object
return 'object';
};

View File

@@ -0,0 +1,139 @@
{
"_from": "kind-of@^3.0.2",
"_id": "kind-of@3.2.2",
"_inBundle": false,
"_integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
"_location": "/http-proxy-middleware/kind-of",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "kind-of@^3.0.2",
"name": "kind-of",
"escapedName": "kind-of",
"rawSpec": "^3.0.2",
"saveSpec": null,
"fetchSpec": "^3.0.2"
},
"_requiredBy": [
"/http-proxy-middleware/micromatch"
],
"_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
"_shasum": "31ea21a734bab9bbb0f32466d893aea51e4a3c64",
"_spec": "kind-of@^3.0.2",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\http-proxy-middleware\\node_modules\\micromatch",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/kind-of/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "David Fox-Powell",
"url": "https://dtothefp.github.io/me"
},
{
"name": "Jon Schlinkert",
"url": "http://twitter.com/jonschlinkert"
},
{
"name": "Ken Sheedlo",
"url": "kensheedlo.com"
},
{
"name": "laggingreflex",
"url": "https://github.com/laggingreflex"
},
{
"name": "Miguel Mota",
"url": "https://miguelmota.com"
},
{
"name": "Peter deHaan",
"url": "http://about.me/peterdehaan"
}
],
"dependencies": {
"is-buffer": "^1.1.5"
},
"deprecated": false,
"description": "Get the native type of a value.",
"devDependencies": {
"ansi-bold": "^0.1.1",
"benchmarked": "^1.0.0",
"browserify": "^14.3.0",
"glob": "^7.1.1",
"gulp-format-md": "^0.1.12",
"mocha": "^3.3.0",
"type-of": "^2.0.1",
"typeof": "^1.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/kind-of",
"keywords": [
"arguments",
"array",
"boolean",
"check",
"date",
"function",
"is",
"is-type",
"is-type-of",
"kind",
"kind-of",
"number",
"object",
"of",
"regexp",
"string",
"test",
"type",
"type-of",
"typeof",
"types"
],
"license": "MIT",
"main": "index.js",
"name": "kind-of",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/kind-of.git"
},
"scripts": {
"prepublish": "browserify -o browser.js -e index.js -s index --bare",
"test": "mocha"
},
"verb": {
"related": {
"list": [
"is-glob",
"is-number",
"is-primitive"
]
},
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"lint": {
"reflinks": true
},
"reflinks": [
"verb"
]
},
"version": "3.2.2"
}

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2015, 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.

View File

@@ -0,0 +1,689 @@
# micromatch [![NPM version](https://img.shields.io/npm/v/micromatch.svg?style=flat)](https://www.npmjs.com/package/micromatch) [![NPM downloads](https://img.shields.io/npm/dm/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![Build Status](https://img.shields.io/travis/jonschlinkert/micromatch.svg?style=flat)](https://travis-ci.org/jonschlinkert/micromatch)
> Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.
Micromatch supports all of the same matching features as [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch).
* [mm()](#usage) is the same as [multimatch()](https://github.com/sindresorhus/multimatch)
* [mm.match()](#match) is the same as [minimatch.match()](https://github.com/isaacs/minimatch)
* use [mm.isMatch()](#ismatch) instead of [minimatch()](https://github.com/isaacs/minimatch)
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save micromatch
```
## Start matching!
```js
var mm = require('micromatch');
console.log(mm(['']))
```
***
### Features
* [Drop-in replacement](#switch-from-minimatch) for [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch)
* Built-in support for multiple glob patterns, like `['foo/*.js', '!bar.js']`
* [Brace Expansion](https://github.com/jonschlinkert/braces) (`foo/bar-{1..5}.md`, `one/{two,three}/four.md`)
* Typical glob patterns, like `**/*`, `a/b/*.js`, or `['foo/*.js', '!bar.js']`
* Methods like `.isMatch()`, `.contains()` and `.any()`
**Extended globbing features:**
* Logical `OR` (`foo/bar/(abc|xyz).js`)
* Regex character classes (`foo/bar/baz-[1-5].js`)
* POSIX [bracket expressions](https://github.com/jonschlinkert/expand-brackets) (`**/[[:alpha:][:digit:]]/`)
* [extglobs](https://github.com/jonschlinkert/extglob) (`**/+(x|y)`, `!(a|b)`, etc).
You can combine these to create whatever matching patterns you need.
**Example**
```js
// double-negation!
mm(['fa', 'fb', 'f', 'fo'], '!(f!(o))');
//=> ['fo']
```
## Why switch to micromatch?
* Native support for multiple glob patterns, no need for wrappers like [multimatch](https://github.com/sindresorhus/multimatch)
* [10-55x faster](#benchmarks) and more performant than [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch). This is achieved through a combination of caching and regex optimization strategies, a fundamentally different approach than minimatch.
* More extensive support for the Bash 4.3 specification
* More complete extglob support
* Extensive [unit tests](./test) (approx. 1,300 tests). Minimatch fails many of the tests.
### Switch from minimatch
Use `mm.isMatch()` instead of `minimatch()`:
```js
mm.isMatch('foo', 'b*');
//=> false
```
Use `mm.match()` instead of `minimatch.match()`:
```js
mm.match(['foo', 'bar'], 'b*');
//=> 'bar'
```
### Switch from multimatch
Same signature:
```js
mm(['foo', 'bar', 'baz'], ['f*', '*z']);
//=> ['foo', 'baz']
```
***
## Usage
Add micromatch to your node.js project:
```js
var mm = require('micromatch');
```
**Signature**
```js
mm(array_of_strings, glob_patterns[, options]);
```
**Example**
```js
mm(['foo', 'bar', 'baz'], 'b*');
//=> ['bar', 'baz']
```
### Usage examples
**Brace expansion**
Match files with `.js` or `.txt` extensions.
```js
mm(['a.js', 'b.md', 'c.txt'], '*.{js,txt}');
//=> ['a.js', 'c.txt']
```
**Extglobs**
Match anything except for files with the `.md` extension.
```js
mm(files, '**/*.!(md)');
//=> ['a.js', 'c.txt']
```
**Multiple patterns**
Match using an array of patterns.
```js
mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.md', '*.txt']);
//=> ['a.md', 'c.txt']
```
**Negation patterns:**
Behavior is designed to be what users would expect, based on conventions that are already well-established.
* [minimatch](https://github.com/isaacs/minimatch) behavior is used when the pattern is a string, so patterns are **inclusive by default**.
* [multimatch](https://github.com/sindresorhus/multimatch) behavior is used when an array of patterns is passed, so patterns are **exclusive by default**.
```js
mm(['a.js', 'b.md', 'c.txt'], '!*.{js,txt}');
//=> ['b.md']
mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.*', '!*.{js,txt}']);
//=> ['a.md', 'd.json']
```
***
## API methods
```js
var mm = require('micromatch');
```
### .match
```js
mm.match(array, globString);
```
Return an array of files that match the given glob pattern. Useful if you only need to use a single glob pattern.
**Example**
```js
mm.match(['ab', 'a/b', 'bb', 'b/c'], '?b');
//=> ['ab', 'bb']
mm.match(['ab', 'a/b', 'bb', 'b/c'], '*/b');
//=> ['a/b']
```
### .isMatch
```js
mm.isMatch(filepath, globString);
```
Returns true if a file path matches the given glob pattern.
**Example**
```js
mm.isMatch('.verb.md', '*.md');
//=> false
mm.isMatch('.verb.md', '*.md', {dot: true});
//=> true
```
### .contains
Returns true if any part of a file path matches the given glob pattern. Think of this is "has path" versus "is path".
**Example**
`.isMatch()` would return false for both of the following:
```js
mm.contains('a/b/c', 'a/b');
//=> true
mm.contains('a/b/c', 'a/*');
//=> true
```
### .matcher
Returns a function for matching using the supplied pattern. e.g. create your own "matcher". The advantage of this method is that the pattern can be compiled outside of a loop.
**Pattern**
Can be any of the following:
* `glob/string`
* `regex`
* `function`
**Example**
```js
var isMatch = mm.matcher('*.md');
var files = [];
['a.md', 'b.txt', 'c.md'].forEach(function(fp) {
if (isMatch(fp)) {
files.push(fp);
}
});
```
### .filter
Returns a function that can be passed to `Array#filter()`.
**Params**
* `patterns` **{String|Array}**:
**Examples**
Single glob:
```js
var fn = mm.filter('*.md');
['a.js', 'b.txt', 'c.md'].filter(fn);
//=> ['c.md']
var fn = mm.filter('[a-c]');
['a', 'b', 'c', 'd', 'e'].filter(fn);
//=> ['a', 'b', 'c']
```
Array of glob patterns:
```js
var arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var fn = mm.filter(['{1..10}', '![7-9]', '!{3..4}']);
arr.filter(fn);
//=> [1, 2, 5, 6, 10]
```
_(Internally this function generates the matching function by using the [matcher](#matcher) method. You can use the [matcher](#matcher) method directly to create your own filter function)_
### .any
Returns true if a file path matches any of the given patterns.
```js
mm.any(filepath, patterns, options);
```
**Params**
* filepath `{String}`: The file path to test.
* patterns `{String|Array}`: One or more glob patterns
* options: `{Object}`: options to pass to the `.matcher()` method.
**Example**
```js
mm.any('abc', ['!*z']);
//=> true
mm.any('abc', ['a*', 'z*']);
//=> true
mm.any('abc', 'a*');
//=> true
mm.any('abc', ['z*']);
//=> false
```
### .expand
Returns an object with a regex-compatible string and tokens.
```js
mm.expand('*.js');
// when `track` is enabled (for debugging), the `history` array is used
// to record each mutation to the glob pattern as it's converted to regex
{ options: { track: false, dot: undefined, makeRe: true, negated: false },
pattern: '(.*\\/|^)bar\\/(?:(?!(?:^|\\/)\\.).)*?',
history: [],
tokens:
{ path:
{ whole: '**/bar/**',
dirname: '**/bar/',
filename: '**',
basename: '**',
extname: '',
ext: '' },
is:
{ glob: true,
negated: false,
globstar: true,
dotfile: false,
dotdir: false },
match: {},
original: '**/bar/**',
pattern: '**/bar/**',
base: '' } }
```
### .makeRe
Create a regular expression for matching file paths based on the given pattern:
```js
mm.makeRe('*.js');
//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
```
## Options
### options.unixify
Normalize slashes in file paths and glob patterns to forward slashes.
Type: `{Boolean}`
Default: `undefined` on non-windows, `true` on windows.
### options.dot
Match dotfiles. Same behavior as [minimatch](https://github.com/isaacs/minimatch).
Type: `{Boolean}`
Default: `false`
### options.unescape
Unescape slashes in glob patterns. Use cautiously, especially on windows.
Type: `{Boolean}`
Default: `undefined`
**Example**
```js
mm.isMatch('abc', '\\a\\b\\c', {unescape: true});
//=> true
```
### options.nodupes
Remove duplicate elements from the result array.
Type: `{Boolean}`
Default: `undefined`
**Example**
Example of using the `unescape` and `nodupes` options together:
```js
mm.match(['abc', '\\a\\b\\c'], '\\a\\b\\c', {unescape: true});
//=> ['abc', 'abc']
mm.match(['abc', '\\a\\b\\c'], '\\a\\b\\c', {unescape: true, nodupes: true});
//=> ['abc']
```
### options.matchBase
Allow glob patterns without slashes to match a file path based on its basename. . Same behavior as [minimatch](https://github.com/isaacs/minimatch).
Type: `{Boolean}`
Default: `false`
**Example**
```js
mm(['a/b.js', 'a/c.md'], '*.js');
//=> []
mm(['a/b.js', 'a/c.md'], '*.js', {matchBase: true});
//=> ['a/b.js']
```
### options.nobraces
Don't expand braces in glob patterns. Same behavior as [minimatch](https://github.com/isaacs/minimatch) `nobrace`.
Type: `{Boolean}`
Default: `undefined`
See [braces](https://github.com/jonschlinkert/braces) for more information about extended brace expansion.
### options.nobrackets
Don't expand POSIX bracket expressions.
Type: `{Boolean}`
Default: `undefined`
See [expand-brackets](https://github.com/jonschlinkert/expand-brackets) for more information about extended bracket expressions.
### options.noextglob
Don't expand extended globs.
Type: `{Boolean}`
Default: `undefined`
See [extglob](https://github.com/jonschlinkert/extglob) for more information about extended globs.
### options.nocase
Use a case-insensitive regex for matching files. Same behavior as [minimatch](https://github.com/isaacs/minimatch).
Type: `{Boolean}`
Default: `false`
### options.nonegate
Disallow negation (`!`) patterns.
Type: `{Boolean}`
Default: `false`
### options.nonull
If `true`, when no matches are found the actual (array-ified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch).
Type: `{Boolean}`
Default: `false`
### options.cache
Cache the platform (e.g. `win32`) to prevent this from being looked up for every filepath.
Type: `{Boolean}`
Default: `true`
***
## Other features
Micromatch also supports the following.
### Extended globbing
#### extglobs
Extended globbing, as described by the bash man page:
| **pattern** | **regex equivalent** | **description** |
| --- | --- | --- |
| `?(pattern-list)` | `(... | ...)?` | Matches zero or one occurrence of the given patterns |
| `*(pattern-list)` | `(... | ...)*` | Matches zero or more occurrences of the given patterns |
| `+(pattern-list)` | `(... | ...)+` | Matches one or more occurrences of the given patterns |
| `@(pattern-list)` | `(... | ...)` <sup>*</sup> | Matches one of the given patterns |
| `!(pattern-list)` | N/A | Matches anything except one of the given patterns |
<sup><strong>*</strong></sup> `@` isn't a RegEx character.
Powered by [extglob](https://github.com/jonschlinkert/extglob). Visit that library for the full range of options or to report extglob related issues.
See [extglob](https://github.com/jonschlinkert/extglob) for more information about extended globs.
#### brace expansion
In simple cases, brace expansion appears to work the same way as the logical `OR` operator. For example, `(a|b)` will achieve the same result as `{a,b}`.
Here are some powerful features unique to brace expansion (versus character classes):
* range expansion: `a{1..3}b/*.js` expands to: `['a1b/*.js', 'a2b/*.js', 'a3b/*.js']`
* nesting: `a{c,{d,e}}b/*.js` expands to: `['acb/*.js', 'adb/*.js', 'aeb/*.js']`
Visit [braces](https://github.com/jonschlinkert/braces) to ask questions and create an issue related to brace-expansion, or to see the full range of features and options related to brace expansion.
#### regex character classes
With the exception of brace expansion (`{a,b}`, `{1..5}`, etc), most of the special characters convert directly to regex, so you can expect them to follow the same rules and produce the same results as regex.
For example, given the list: `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`:
* `[ac].js`: matches both `a` and `c`, returning `['a.js', 'c.js']`
* `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']`
* `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']`
* `a/[A-Z].js`: matches and uppercase letter, returning `['a/E.md']`
Learn about [regex character classes](http://www.regular-expressions.info/charclass.html).
#### regex groups
Given `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`:
* `(a|c).js`: would match either `a` or `c`, returning `['a.js', 'c.js']`
* `(b|d).js`: would match either `b` or `d`, returning `['b.js', 'd.js']`
* `(b|[A-Z]).js`: would match either `b` or an uppercase letter, returning `['b.js', 'E.js']`
As with regex, parenthese can be nested, so patterns like `((a|b)|c)/b` will work. But it might be easier to achieve your goal using brace expansion.
#### POSIX bracket expressions
**Example**
```js
mm.isMatch('a1', '[[:alpha:][:digit:]]');
//=> true
```
See [expand-brackets](https://github.com/jonschlinkert/expand-brackets) for more information about extended bracket expressions.
***
## Notes
Whenever possible parsing behavior for patterns is based on globbing specifications in Bash 4.3. Patterns that aren't described by Bash follow wildmatch spec (used by git).
## Benchmarks
Run the [benchmarks](./benchmark):
```bash
node benchmark
```
As of July 15, 2016:
```bash
#1: basename-braces
micromatch x 26,420 ops/sec ±0.89% (91 runs sampled)
minimatch x 3,507 ops/sec ±0.64% (97 runs sampled)
#2: basename
micromatch x 25,315 ops/sec ±0.82% (93 runs sampled)
minimatch x 4,398 ops/sec ±0.86% (94 runs sampled)
#3: braces-no-glob
micromatch x 341,254 ops/sec ±0.78% (93 runs sampled)
minimatch x 30,197 ops/sec ±1.12% (91 runs sampled)
#4: braces
micromatch x 54,649 ops/sec ±0.74% (94 runs sampled)
minimatch x 3,095 ops/sec ±0.82% (95 runs sampled)
#5: immediate
micromatch x 16,719 ops/sec ±0.79% (95 runs sampled)
minimatch x 4,348 ops/sec ±0.86% (96 runs sampled)
#6: large
micromatch x 721 ops/sec ±0.77% (94 runs sampled)
minimatch x 17.73 ops/sec ±1.08% (50 runs sampled)
#7: long
micromatch x 5,051 ops/sec ±0.87% (97 runs sampled)
minimatch x 628 ops/sec ±0.83% (94 runs sampled)
#8: mid
micromatch x 51,280 ops/sec ±0.80% (95 runs sampled)
minimatch x 1,923 ops/sec ±0.84% (95 runs sampled)
#9: multi-patterns
micromatch x 22,440 ops/sec ±0.97% (94 runs sampled)
minimatch x 2,481 ops/sec ±1.10% (94 runs sampled)
#10: no-glob
micromatch x 722,823 ops/sec ±1.30% (87 runs sampled)
minimatch x 52,967 ops/sec ±1.09% (94 runs sampled)
#11: range
micromatch x 243,471 ops/sec ±0.79% (94 runs sampled)
minimatch x 11,736 ops/sec ±0.82% (96 runs sampled)
#12: shallow
micromatch x 190,874 ops/sec ±0.98% (95 runs sampled)
minimatch x 21,699 ops/sec ±0.81% (97 runs sampled)
#13: short
micromatch x 496,393 ops/sec ±3.86% (90 runs sampled)
minimatch x 53,765 ops/sec ±0.75% (95 runs sampled)
```
## Tests
### Running tests
Install dev dependencies:
```sh
$ npm install -d && npm test
```
### Coverage
As of July 15, 2016:
```sh
Statements : 100% (441/441)
Branches : 100% (270/270)
Functions : 100% (54/54)
Lines : 100% (429/429)
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
Please be sure to run the benchmarks before/after any code changes to judge the impact before you do a PR. thanks!
## Related
* [braces](https://www.npmjs.com/package/braces): Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces… [more](https://github.com/jonschlinkert/braces) | [homepage](https://github.com/jonschlinkert/braces "Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.")
* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/jonschlinkert/expand-brackets "Expand POSIX bracket expressions (character classes) in glob patterns.")
* [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://github.com/jonschlinkert/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range "Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See the benchmarks. Used by micromatch.")
* [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://github.com/jonschlinkert/extglob) | [homepage](https://github.com/jonschlinkert/extglob "Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to glob patterns.")
* [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://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or multiplier to use.")
* [gulp-micromatch](https://www.npmjs.com/package/gulp-micromatch): Filter vinyl files with glob patterns, string, regexp, array, object or matcher function. micromatch stream. | [homepage](https://github.com/tunnckocore/gulp-micromatch#readme "Filter vinyl files with glob patterns, string, regexp, array, object or matcher function. micromatch stream.")
* [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://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
* [parse-glob](https://www.npmjs.com/package/parse-glob): Parse a glob pattern into an object of tokens. | [homepage](https://github.com/jonschlinkert/parse-glob "Parse a glob pattern into an object of tokens.")
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
## 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).)_
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm install -g verb verb-generate-readme && 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/micromatch/blob/master/LICENSE).
***
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on July 15, 2016._

View File

@@ -0,0 +1,431 @@
/*!
* micromatch <https://github.com/jonschlinkert/micromatch>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
var expand = require('./lib/expand');
var utils = require('./lib/utils');
/**
* The main function. Pass an array of filepaths,
* and a string or array of glob patterns
*
* @param {Array|String} `files`
* @param {Array|String} `patterns`
* @param {Object} `opts`
* @return {Array} Array of matches
*/
function micromatch(files, patterns, opts) {
if (!files || !patterns) return [];
opts = opts || {};
if (typeof opts.cache === 'undefined') {
opts.cache = true;
}
if (!Array.isArray(patterns)) {
return match(files, patterns, opts);
}
var len = patterns.length, i = 0;
var omit = [], keep = [];
while (len--) {
var glob = patterns[i++];
if (typeof glob === 'string' && glob.charCodeAt(0) === 33 /* ! */) {
omit.push.apply(omit, match(files, glob.slice(1), opts));
} else {
keep.push.apply(keep, match(files, glob, opts));
}
}
return utils.diff(keep, omit);
}
/**
* Return an array of files that match the given glob pattern.
*
* This function is called by the main `micromatch` function If you only
* need to pass a single pattern you might get very minor speed improvements
* using this function.
*
* @param {Array} `files`
* @param {String} `pattern`
* @param {Object} `options`
* @return {Array}
*/
function match(files, pattern, opts) {
if (utils.typeOf(files) !== 'string' && !Array.isArray(files)) {
throw new Error(msg('match', 'files', 'a string or array'));
}
files = utils.arrayify(files);
opts = opts || {};
var negate = opts.negate || false;
var orig = pattern;
if (typeof pattern === 'string') {
negate = pattern.charAt(0) === '!';
if (negate) {
pattern = pattern.slice(1);
}
// we need to remove the character regardless,
// so the above logic is still needed
if (opts.nonegate === true) {
negate = false;
}
}
var _isMatch = matcher(pattern, opts);
var len = files.length, i = 0;
var res = [];
while (i < len) {
var file = files[i++];
var fp = utils.unixify(file, opts);
if (!_isMatch(fp)) { continue; }
res.push(fp);
}
if (res.length === 0) {
if (opts.failglob === true) {
throw new Error('micromatch.match() found no matches for: "' + orig + '".');
}
if (opts.nonull || opts.nullglob) {
res.push(utils.unescapeGlob(orig));
}
}
// if `negate` was defined, diff negated files
if (negate) { res = utils.diff(files, res); }
// if `ignore` was defined, diff ignored filed
if (opts.ignore && opts.ignore.length) {
pattern = opts.ignore;
opts = utils.omit(opts, ['ignore']);
res = utils.diff(res, micromatch(res, pattern, opts));
}
if (opts.nodupes) {
return utils.unique(res);
}
return res;
}
/**
* Returns a function that takes a glob pattern or array of glob patterns
* to be used with `Array#filter()`. (Internally this function generates
* the matching function using the [matcher] method).
*
* ```js
* var fn = mm.filter('[a-c]');
* ['a', 'b', 'c', 'd', 'e'].filter(fn);
* //=> ['a', 'b', 'c']
* ```
* @param {String|Array} `patterns` Can be a glob or array of globs.
* @param {Options} `opts` Options to pass to the [matcher] method.
* @return {Function} Filter function to be passed to `Array#filter()`.
*/
function filter(patterns, opts) {
if (!Array.isArray(patterns) && typeof patterns !== 'string') {
throw new TypeError(msg('filter', 'patterns', 'a string or array'));
}
patterns = utils.arrayify(patterns);
var len = patterns.length, i = 0;
var patternMatchers = Array(len);
while (i < len) {
patternMatchers[i] = matcher(patterns[i++], opts);
}
return function(fp) {
if (fp == null) return [];
var len = patternMatchers.length, i = 0;
var res = true;
fp = utils.unixify(fp, opts);
while (i < len) {
var fn = patternMatchers[i++];
if (!fn(fp)) {
res = false;
break;
}
}
return res;
};
}
/**
* Returns true if the filepath contains the given
* pattern. Can also return a function for matching.
*
* ```js
* isMatch('foo.md', '*.md', {});
* //=> true
*
* isMatch('*.md', {})('foo.md')
* //=> true
* ```
* @param {String} `fp`
* @param {String} `pattern`
* @param {Object} `opts`
* @return {Boolean}
*/
function isMatch(fp, pattern, opts) {
if (typeof fp !== 'string') {
throw new TypeError(msg('isMatch', 'filepath', 'a string'));
}
fp = utils.unixify(fp, opts);
if (utils.typeOf(pattern) === 'object') {
return matcher(fp, pattern);
}
return matcher(pattern, opts)(fp);
}
/**
* Returns true if the filepath matches the
* given pattern.
*/
function contains(fp, pattern, opts) {
if (typeof fp !== 'string') {
throw new TypeError(msg('contains', 'pattern', 'a string'));
}
opts = opts || {};
opts.contains = (pattern !== '');
fp = utils.unixify(fp, opts);
if (opts.contains && !utils.isGlob(pattern)) {
return fp.indexOf(pattern) !== -1;
}
return matcher(pattern, opts)(fp);
}
/**
* Returns true if a file path matches any of the
* given patterns.
*
* @param {String} `fp` The filepath to test.
* @param {String|Array} `patterns` Glob patterns to use.
* @param {Object} `opts` Options to pass to the `matcher()` function.
* @return {String}
*/
function any(fp, patterns, opts) {
if (!Array.isArray(patterns) && typeof patterns !== 'string') {
throw new TypeError(msg('any', 'patterns', 'a string or array'));
}
patterns = utils.arrayify(patterns);
var len = patterns.length;
fp = utils.unixify(fp, opts);
while (len--) {
var isMatch = matcher(patterns[len], opts);
if (isMatch(fp)) {
return true;
}
}
return false;
}
/**
* Filter the keys of an object with the given `glob` pattern
* and `options`
*
* @param {Object} `object`
* @param {Pattern} `object`
* @return {Array}
*/
function matchKeys(obj, glob, options) {
if (utils.typeOf(obj) !== 'object') {
throw new TypeError(msg('matchKeys', 'first argument', 'an object'));
}
var fn = matcher(glob, options);
var res = {};
for (var key in obj) {
if (obj.hasOwnProperty(key) && fn(key)) {
res[key] = obj[key];
}
}
return res;
}
/**
* Return a function for matching based on the
* given `pattern` and `options`.
*
* @param {String} `pattern`
* @param {Object} `options`
* @return {Function}
*/
function matcher(pattern, opts) {
// pattern is a function
if (typeof pattern === 'function') {
return pattern;
}
// pattern is a regex
if (pattern instanceof RegExp) {
return function(fp) {
return pattern.test(fp);
};
}
if (typeof pattern !== 'string') {
throw new TypeError(msg('matcher', 'pattern', 'a string, regex, or function'));
}
// strings, all the way down...
pattern = utils.unixify(pattern, opts);
// pattern is a non-glob string
if (!utils.isGlob(pattern)) {
return utils.matchPath(pattern, opts);
}
// pattern is a glob string
var re = makeRe(pattern, opts);
// `matchBase` is defined
if (opts && opts.matchBase) {
return utils.hasFilename(re, opts);
}
// `matchBase` is not defined
return function(fp) {
fp = utils.unixify(fp, opts);
return re.test(fp);
};
}
/**
* Create and cache a regular expression for matching
* file paths.
*
* If the leading character in the `glob` is `!`, a negation
* regex is returned.
*
* @param {String} `glob`
* @param {Object} `options`
* @return {RegExp}
*/
function toRegex(glob, options) {
// clone options to prevent mutating the original object
var opts = Object.create(options || {});
var flags = opts.flags || '';
if (opts.nocase && flags.indexOf('i') === -1) {
flags += 'i';
}
var parsed = expand(glob, opts);
// pass in tokens to avoid parsing more than once
opts.negated = opts.negated || parsed.negated;
opts.negate = opts.negated;
glob = wrapGlob(parsed.pattern, opts);
var re;
try {
re = new RegExp(glob, flags);
return re;
} catch (err) {
err.reason = 'micromatch invalid regex: (' + re + ')';
if (opts.strict) throw new SyntaxError(err);
}
// we're only here if a bad pattern was used and the user
// passed `options.silent`, so match nothing
return /$^/;
}
/**
* Create the regex to do the matching. If the leading
* character in the `glob` is `!` a negation regex is returned.
*
* @param {String} `glob`
* @param {Boolean} `negate`
*/
function wrapGlob(glob, opts) {
var prefix = (opts && !opts.contains) ? '^' : '';
var after = (opts && !opts.contains) ? '$' : '';
glob = ('(?:' + glob + ')' + after);
if (opts && opts.negate) {
return prefix + ('(?!^' + glob + ').*$');
}
return prefix + glob;
}
/**
* Create and cache a regular expression for matching file paths.
* If the leading character in the `glob` is `!`, a negation
* regex is returned.
*
* @param {String} `glob`
* @param {Object} `options`
* @return {RegExp}
*/
function makeRe(glob, opts) {
if (utils.typeOf(glob) !== 'string') {
throw new Error(msg('makeRe', 'glob', 'a string'));
}
return utils.cache(toRegex, glob, opts);
}
/**
* Make error messages consistent. Follows this format:
*
* ```js
* msg(methodName, argNumber, nativeType);
* // example:
* msg('matchKeys', 'first', 'an object');
* ```
*
* @param {String} `method`
* @param {String} `num`
* @param {String} `type`
* @return {String}
*/
function msg(method, what, type) {
return 'micromatch.' + method + '(): ' + what + ' should be ' + type + '.';
}
/**
* Public methods
*/
/* eslint no-multi-spaces: 0 */
micromatch.any = any;
micromatch.braces = micromatch.braceExpand = utils.braces;
micromatch.contains = contains;
micromatch.expand = expand;
micromatch.filter = filter;
micromatch.isMatch = isMatch;
micromatch.makeRe = makeRe;
micromatch.match = match;
micromatch.matcher = matcher;
micromatch.matchKeys = matchKeys;
/**
* Expose `micromatch`
*/
module.exports = micromatch;

View File

@@ -0,0 +1,67 @@
'use strict';
var chars = {}, unesc, temp;
function reverse(object, prepender) {
return Object.keys(object).reduce(function(reversed, key) {
var newKey = prepender ? prepender + key : key; // Optionally prepend a string to key.
reversed[object[key]] = newKey; // Swap key and value.
return reversed; // Return the result.
}, {});
}
/**
* Regex for common characters
*/
chars.escapeRegex = {
'?': /\?/g,
'@': /\@/g,
'!': /\!/g,
'+': /\+/g,
'*': /\*/g,
'(': /\(/g,
')': /\)/g,
'[': /\[/g,
']': /\]/g
};
/**
* Escape characters
*/
chars.ESC = {
'?': '__UNESC_QMRK__',
'@': '__UNESC_AMPE__',
'!': '__UNESC_EXCL__',
'+': '__UNESC_PLUS__',
'*': '__UNESC_STAR__',
',': '__UNESC_COMMA__',
'(': '__UNESC_LTPAREN__',
')': '__UNESC_RTPAREN__',
'[': '__UNESC_LTBRACK__',
']': '__UNESC_RTBRACK__'
};
/**
* Unescape characters
*/
chars.UNESC = unesc || (unesc = reverse(chars.ESC, '\\'));
chars.ESC_TEMP = {
'?': '__TEMP_QMRK__',
'@': '__TEMP_AMPE__',
'!': '__TEMP_EXCL__',
'*': '__TEMP_STAR__',
'+': '__TEMP_PLUS__',
',': '__TEMP_COMMA__',
'(': '__TEMP_LTPAREN__',
')': '__TEMP_RTPAREN__',
'[': '__TEMP_LTBRACK__',
']': '__TEMP_RTBRACK__'
};
chars.TEMP = temp || (temp = reverse(chars.ESC_TEMP));
module.exports = chars;

View File

@@ -0,0 +1,304 @@
/*!
* micromatch <https://github.com/jonschlinkert/micromatch>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
var utils = require('./utils');
var Glob = require('./glob');
/**
* Expose `expand`
*/
module.exports = expand;
/**
* Expand a glob pattern to resolve braces and
* similar patterns before converting to regex.
*
* @param {String|Array} `pattern`
* @param {Array} `files`
* @param {Options} `opts`
* @return {Array}
*/
function expand(pattern, options) {
if (typeof pattern !== 'string') {
throw new TypeError('micromatch.expand(): argument should be a string.');
}
var glob = new Glob(pattern, options || {});
var opts = glob.options;
if (!utils.isGlob(pattern)) {
glob.pattern = glob.pattern.replace(/([\/.])/g, '\\$1');
return glob;
}
glob.pattern = glob.pattern.replace(/(\+)(?!\()/g, '\\$1');
glob.pattern = glob.pattern.split('$').join('\\$');
if (typeof opts.braces !== 'boolean' && typeof opts.nobraces !== 'boolean') {
opts.braces = true;
}
if (glob.pattern === '.*') {
return {
pattern: '\\.' + star,
tokens: tok,
options: opts
};
}
if (glob.pattern === '*') {
return {
pattern: oneStar(opts.dot),
tokens: tok,
options: opts
};
}
// parse the glob pattern into tokens
glob.parse();
var tok = glob.tokens;
tok.is.negated = opts.negated;
// dotfile handling
if ((opts.dotfiles === true || tok.is.dotfile) && opts.dot !== false) {
opts.dotfiles = true;
opts.dot = true;
}
if ((opts.dotdirs === true || tok.is.dotdir) && opts.dot !== false) {
opts.dotdirs = true;
opts.dot = true;
}
// check for braces with a dotfile pattern
if (/[{,]\./.test(glob.pattern)) {
opts.makeRe = false;
opts.dot = true;
}
if (opts.nonegate !== true) {
opts.negated = glob.negated;
}
// if the leading character is a dot or a slash, escape it
if (glob.pattern.charAt(0) === '.' && glob.pattern.charAt(1) !== '/') {
glob.pattern = '\\' + glob.pattern;
}
/**
* Extended globs
*/
// expand braces, e.g `{1..5}`
glob.track('before braces');
if (tok.is.braces) {
glob.braces();
}
glob.track('after braces');
// expand extglobs, e.g `foo/!(a|b)`
glob.track('before extglob');
if (tok.is.extglob) {
glob.extglob();
}
glob.track('after extglob');
// expand brackets, e.g `[[:alpha:]]`
glob.track('before brackets');
if (tok.is.brackets) {
glob.brackets();
}
glob.track('after brackets');
// special patterns
glob._replace('[!', '[^');
glob._replace('(?', '(%~');
glob._replace(/\[\]/, '\\[\\]');
glob._replace('/[', '/' + (opts.dot ? dotfiles : nodot) + '[', true);
glob._replace('/?', '/' + (opts.dot ? dotfiles : nodot) + '[^/]', true);
glob._replace('/.', '/(?=.)\\.', true);
// windows drives
glob._replace(/^(\w):([\\\/]+?)/gi, '(?=.)$1:$2', true);
// negate slashes in exclusion ranges
if (glob.pattern.indexOf('[^') !== -1) {
glob.pattern = negateSlash(glob.pattern);
}
if (opts.globstar !== false && glob.pattern === '**') {
glob.pattern = globstar(opts.dot);
} else {
glob.pattern = balance(glob.pattern, '[', ']');
glob.escape(glob.pattern);
// if the pattern has `**`
if (tok.is.globstar) {
glob.pattern = collapse(glob.pattern, '/**');
glob.pattern = collapse(glob.pattern, '**/');
glob._replace('/**/', '(?:/' + globstar(opts.dot) + '/|/)', true);
glob._replace(/\*{2,}/g, '**');
// 'foo/*'
glob._replace(/(\w+)\*(?!\/)/g, '$1[^/]*?', true);
glob._replace(/\*\*\/\*(\w)/g, globstar(opts.dot) + '\\/' + (opts.dot ? dotfiles : nodot) + '[^/]*?$1', true);
if (opts.dot !== true) {
glob._replace(/\*\*\/(.)/g, '(?:**\\/|)$1');
}
// 'foo/**' or '{**,*}', but not 'foo**'
if (tok.path.dirname !== '' || /,\*\*|\*\*,/.test(glob.orig)) {
glob._replace('**', globstar(opts.dot), true);
}
}
// ends with /*
glob._replace(/\/\*$/, '\\/' + oneStar(opts.dot), true);
// ends with *, no slashes
glob._replace(/(?!\/)\*$/, star, true);
// has 'n*.' (partial wildcard w/ file extension)
glob._replace(/([^\/]+)\*/, '$1' + oneStar(true), true);
// has '*'
glob._replace('*', oneStar(opts.dot), true);
glob._replace('?.', '?\\.', true);
glob._replace('?:', '?:', true);
glob._replace(/\?+/g, function(match) {
var len = match.length;
if (len === 1) {
return qmark;
}
return qmark + '{' + len + '}';
});
// escape '.abc' => '\\.abc'
glob._replace(/\.([*\w]+)/g, '\\.$1');
// fix '[^\\\\/]'
glob._replace(/\[\^[\\\/]+\]/g, qmark);
// '///' => '\/'
glob._replace(/\/+/g, '\\/');
// '\\\\\\' => '\\'
glob._replace(/\\{2,}/g, '\\');
}
// unescape previously escaped patterns
glob.unescape(glob.pattern);
glob._replace('__UNESC_STAR__', '*');
// escape dots that follow qmarks
glob._replace('?.', '?\\.');
// remove unnecessary slashes in character classes
glob._replace('[^\\/]', qmark);
if (glob.pattern.length > 1) {
if (/^[\[?*]/.test(glob.pattern)) {
// only prepend the string if we don't want to match dotfiles
glob.pattern = (opts.dot ? dotfiles : nodot) + glob.pattern;
}
}
return glob;
}
/**
* Collapse repeated character sequences.
*
* ```js
* collapse('a/../../../b', '../');
* //=> 'a/../b'
* ```
*
* @param {String} `str`
* @param {String} `ch` Character sequence to collapse
* @return {String}
*/
function collapse(str, ch) {
var res = str.split(ch);
var isFirst = res[0] === '';
var isLast = res[res.length - 1] === '';
res = res.filter(Boolean);
if (isFirst) res.unshift('');
if (isLast) res.push('');
return res.join(ch);
}
/**
* Negate slashes in exclusion ranges, per glob spec:
*
* ```js
* negateSlash('[^foo]');
* //=> '[^\\/foo]'
* ```
*
* @param {String} `str` glob pattern
* @return {String}
*/
function negateSlash(str) {
return str.replace(/\[\^([^\]]*?)\]/g, function(match, inner) {
if (inner.indexOf('/') === -1) {
inner = '\\/' + inner;
}
return '[^' + inner + ']';
});
}
/**
* Escape imbalanced braces/bracket. This is a very
* basic, naive implementation that only does enough
* to serve the purpose.
*/
function balance(str, a, b) {
var aarr = str.split(a);
var alen = aarr.join('').length;
var blen = str.split(b).join('').length;
if (alen !== blen) {
str = aarr.join('\\' + a);
return str.split(b).join('\\' + b);
}
return str;
}
/**
* Special patterns to be converted to regex.
* Heuristics are used to simplify patterns
* and speed up processing.
*/
/* eslint no-multi-spaces: 0 */
var qmark = '[^/]';
var star = qmark + '*?';
var nodot = '(?!\\.)(?=.)';
var dotfileGlob = '(?:\\/|^)\\.{1,2}($|\\/)';
var dotfiles = '(?!' + dotfileGlob + ')(?=.)';
var twoStarDot = '(?:(?!' + dotfileGlob + ').)*?';
/**
* Create a regex for `*`.
*
* If `dot` is true, or the pattern does not begin with
* a leading star, then return the simpler regex.
*/
function oneStar(dotfile) {
return dotfile ? '(?!' + dotfileGlob + ')(?=.)' + star : (nodot + star);
}
function globstar(dotfile) {
if (dotfile) { return twoStarDot; }
return '(?:(?!(?:\\/|^)\\.).)*?';
}

View File

@@ -0,0 +1,193 @@
'use strict';
var chars = require('./chars');
var utils = require('./utils');
/**
* Expose `Glob`
*/
var Glob = module.exports = function Glob(pattern, options) {
if (!(this instanceof Glob)) {
return new Glob(pattern, options);
}
this.options = options || {};
this.pattern = pattern;
this.history = [];
this.tokens = {};
this.init(pattern);
};
/**
* Initialize defaults
*/
Glob.prototype.init = function(pattern) {
this.orig = pattern;
this.negated = this.isNegated();
this.options.track = this.options.track || false;
this.options.makeRe = true;
};
/**
* Push a change into `glob.history`. Useful
* for debugging.
*/
Glob.prototype.track = function(msg) {
if (this.options.track) {
this.history.push({msg: msg, pattern: this.pattern});
}
};
/**
* Return true if `glob.pattern` was negated
* with `!`, also remove the `!` from the pattern.
*
* @return {Boolean}
*/
Glob.prototype.isNegated = function() {
if (this.pattern.charCodeAt(0) === 33 /* '!' */) {
this.pattern = this.pattern.slice(1);
return true;
}
return false;
};
/**
* Expand braces in the given glob pattern.
*
* We only need to use the [braces] lib when
* patterns are nested.
*/
Glob.prototype.braces = function() {
if (this.options.nobraces !== true && this.options.nobrace !== true) {
// naive/fast check for imbalanced characters
var a = this.pattern.match(/[\{\(\[]/g);
var b = this.pattern.match(/[\}\)\]]/g);
// if imbalanced, don't optimize the pattern
if (a && b && (a.length !== b.length)) {
this.options.makeRe = false;
}
// expand brace patterns and join the resulting array
var expanded = utils.braces(this.pattern, this.options);
this.pattern = expanded.join('|');
}
};
/**
* Expand bracket expressions in `glob.pattern`
*/
Glob.prototype.brackets = function() {
if (this.options.nobrackets !== true) {
this.pattern = utils.brackets(this.pattern);
}
};
/**
* Expand bracket expressions in `glob.pattern`
*/
Glob.prototype.extglob = function() {
if (this.options.noextglob === true) return;
if (utils.isExtglob(this.pattern)) {
this.pattern = utils.extglob(this.pattern, {escape: true});
}
};
/**
* Parse the given pattern
*/
Glob.prototype.parse = function(pattern) {
this.tokens = utils.parseGlob(pattern || this.pattern, true);
return this.tokens;
};
/**
* Replace `a` with `b`. Also tracks the change before and
* after each replacement. This is disabled by default, but
* can be enabled by setting `options.track` to true.
*
* Also, when the pattern is a string, `.split()` is used,
* because it's much faster than replace.
*
* @param {RegExp|String} `a`
* @param {String} `b`
* @param {Boolean} `escape` When `true`, escapes `*` and `?` in the replacement.
* @return {String}
*/
Glob.prototype._replace = function(a, b, escape) {
this.track('before (find): "' + a + '" (replace with): "' + b + '"');
if (escape) b = esc(b);
if (a && b && typeof a === 'string') {
this.pattern = this.pattern.split(a).join(b);
} else {
this.pattern = this.pattern.replace(a, b);
}
this.track('after');
};
/**
* Escape special characters in the given string.
*
* @param {String} `str` Glob pattern
* @return {String}
*/
Glob.prototype.escape = function(str) {
this.track('before escape: ');
var re = /["\\](['"]?[^"'\\]['"]?)/g;
this.pattern = str.replace(re, function($0, $1) {
var o = chars.ESC;
var ch = o && o[$1];
if (ch) {
return ch;
}
if (/[a-z]/i.test($0)) {
return $0.split('\\').join('');
}
return $0;
});
this.track('after escape: ');
};
/**
* Unescape special characters in the given string.
*
* @param {String} `str`
* @return {String}
*/
Glob.prototype.unescape = function(str) {
var re = /__([A-Z]+)_([A-Z]+)__/g;
this.pattern = str.replace(re, function($0, $1) {
return chars[$1][$0];
});
this.pattern = unesc(this.pattern);
};
/**
* Escape/unescape utils
*/
function esc(str) {
str = str.split('?').join('%~');
str = str.split('*').join('%%');
return str;
}
function unesc(str) {
str = str.split('%~').join('?');
str = str.split('%%').join('*');
return str;
}

View File

@@ -0,0 +1,149 @@
'use strict';
var win32 = process && process.platform === 'win32';
var path = require('path');
var fileRe = require('filename-regex');
var utils = module.exports;
/**
* Module dependencies
*/
utils.diff = require('arr-diff');
utils.unique = require('array-unique');
utils.braces = require('braces');
utils.brackets = require('expand-brackets');
utils.extglob = require('extglob');
utils.isExtglob = require('is-extglob');
utils.isGlob = require('is-glob');
utils.typeOf = require('kind-of');
utils.normalize = require('normalize-path');
utils.omit = require('object.omit');
utils.parseGlob = require('parse-glob');
utils.cache = require('regex-cache');
/**
* Get the filename of a filepath
*
* @param {String} `string`
* @return {String}
*/
utils.filename = function filename(fp) {
var seg = fp.match(fileRe());
return seg && seg[0];
};
/**
* Returns a function that returns true if the given
* pattern is the same as a given `filepath`
*
* @param {String} `pattern`
* @return {Function}
*/
utils.isPath = function isPath(pattern, opts) {
opts = opts || {};
return function(fp) {
var unixified = utils.unixify(fp, opts);
if(opts.nocase){
return pattern.toLowerCase() === unixified.toLowerCase();
}
return pattern === unixified;
};
};
/**
* Returns a function that returns true if the given
* pattern contains a `filepath`
*
* @param {String} `pattern`
* @return {Function}
*/
utils.hasPath = function hasPath(pattern, opts) {
return function(fp) {
return utils.unixify(pattern, opts).indexOf(fp) !== -1;
};
};
/**
* Returns a function that returns true if the given
* pattern matches or contains a `filepath`
*
* @param {String} `pattern`
* @return {Function}
*/
utils.matchPath = function matchPath(pattern, opts) {
var fn = (opts && opts.contains)
? utils.hasPath(pattern, opts)
: utils.isPath(pattern, opts);
return fn;
};
/**
* Returns a function that returns true if the given
* regex matches the `filename` of a file path.
*
* @param {RegExp} `re`
* @return {Boolean}
*/
utils.hasFilename = function hasFilename(re) {
return function(fp) {
var name = utils.filename(fp);
return name && re.test(name);
};
};
/**
* Coerce `val` to an array
*
* @param {*} val
* @return {Array}
*/
utils.arrayify = function arrayify(val) {
return !Array.isArray(val)
? [val]
: val;
};
/**
* Normalize all slashes in a file path or glob pattern to
* forward slashes.
*/
utils.unixify = function unixify(fp, opts) {
if (opts && opts.unixify === false) return fp;
if (opts && opts.unixify === true || win32 || path.sep === '\\') {
return utils.normalize(fp, false);
}
if (opts && opts.unescape === true) {
return fp ? fp.toString().replace(/\\(\w)/g, '$1') : '';
}
return fp;
};
/**
* Escape/unescape utils
*/
utils.escapePath = function escapePath(fp) {
return fp.replace(/[\\.]/g, '\\$&');
};
utils.unescapeGlob = function unescapeGlob(fp) {
return fp.replace(/[\\"']/g, '');
};
utils.escapeRe = function escapeRe(str) {
return str.replace(/[-[\\$*+?.#^\s{}(|)\]]/g, '\\$&');
};
/**
* Expose `utils`
*/
module.exports = utils;

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2015, 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.

View File

@@ -0,0 +1,75 @@
# is-extglob [![NPM version](https://badge.fury.io/js/is-extglob.svg)](http://badge.fury.io/js/is-extglob) [![Build Status](https://travis-ci.org/jonschlinkert/is-extglob.svg)](https://travis-ci.org/jonschlinkert/is-extglob)
> Returns true if a string has an extglob.
## Install with [npm](npmjs.org)
```bash
npm i is-extglob --save
```
## Usage
```js
var isExtglob = require('is-extglob');
```
**True**
```js
isExtglob('?(abc)');
isExtglob('@(abc)');
isExtglob('!(abc)');
isExtglob('*(abc)');
isExtglob('+(abc)');
```
**False**
Everything else...
```js
isExtglob('foo.js');
isExtglob('!foo.js');
isExtglob('*.js');
isExtglob('**/abc.js');
isExtglob('abc/*.js');
isExtglob('abc/(aaa|bbb).js');
isExtglob('abc/[a-z].js');
isExtglob('abc/{a,b}.js');
isExtglob('abc/?.js');
isExtglob('abc.js');
isExtglob('abc/def/ghi.js');
```
## Related
* [extglob](https://github.com/jonschlinkert/extglob): Extended globs. extglobs add the expressive power of regular expressions to glob patterns.
* [micromatch](https://github.com/jonschlinkert/micromatch): Glob matching for javascript/node.js. A faster alternative to minimatch (10-45x faster on avg), with all the features you're used to using in your Grunt and gulp tasks.
* [parse-glob](https://github.com/jonschlinkert/parse-glob): Parse a glob pattern into an object of tokens.
## Run tests
Install dev dependencies.
```bash
npm i -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-extglob/issues)
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 06, 2015._

View File

@@ -0,0 +1,11 @@
/*!
* is-extglob <https://github.com/jonschlinkert/is-extglob>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
module.exports = function isExtglob(str) {
return typeof str === 'string'
&& /[@?!+*]\(/.test(str);
};

View File

@@ -0,0 +1,77 @@
{
"_from": "is-extglob@^1.0.0",
"_id": "is-extglob@1.0.0",
"_inBundle": false,
"_integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=",
"_location": "/http-proxy-middleware/micromatch/is-extglob",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "is-extglob@^1.0.0",
"name": "is-extglob",
"escapedName": "is-extglob",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/http-proxy-middleware/micromatch",
"/http-proxy-middleware/micromatch/is-glob"
],
"_resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz",
"_shasum": "ac468177c4943405a092fc8f29760c6ffc6206c0",
"_spec": "is-extglob@^1.0.0",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\http-proxy-middleware\\node_modules\\micromatch",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/is-extglob/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Returns true if a string has an extglob.",
"devDependencies": {
"mocha": "*",
"should": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/is-extglob",
"keywords": [
"bash",
"braces",
"check",
"exec",
"extglob",
"expression",
"glob",
"globbing",
"globstar",
"match",
"matches",
"pattern",
"regex",
"regular",
"string",
"test"
],
"license": "MIT",
"main": "index.js",
"name": "is-extglob",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/is-extglob.git"
},
"scripts": {
"prepublish": "browserify -o browser.js -e index.js",
"test": "mocha"
},
"version": "1.0.0"
}

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2015, 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.

View File

@@ -0,0 +1,105 @@
# is-glob [![NPM version](https://badge.fury.io/js/is-glob.svg)](http://badge.fury.io/js/is-glob) [![Build Status](https://travis-ci.org/jonschlinkert/is-glob.svg)](https://travis-ci.org/jonschlinkert/is-glob)
> Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.
Also take a look at [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob).
## Install
Install with [npm](https://www.npmjs.com/)
```sh
$ npm i is-glob --save
```
## Usage
```js
var isGlob = require('is-glob');
```
**True**
Patterns that have glob characters or regex patterns will return `true`:
```js
isGlob('!foo.js');
isGlob('*.js');
isGlob('**/abc.js');
isGlob('abc/*.js');
isGlob('abc/(aaa|bbb).js');
isGlob('abc/[a-z].js');
isGlob('abc/{a,b}.js');
isGlob('abc/?.js');
//=> true
```
Extglobs
```js
isGlob('abc/@(a).js');
isGlob('abc/!(a).js');
isGlob('abc/+(a).js');
isGlob('abc/*(a).js');
isGlob('abc/?(a).js');
//=> true
```
**False**
Patterns that do not have glob patterns return `false`:
```js
isGlob('abc.js');
isGlob('abc/def/ghi.js');
isGlob('foo.js');
isGlob('abc/@.js');
isGlob('abc/+.js');
isGlob();
isGlob(null);
//=> false
```
Arrays are also `false` (If you want to check if an array has a glob pattern, use [has-glob](https://github.com/jonschlinkert/has-glob)):
```js
isGlob(['**/*.js']);
isGlob(['foo.js']);
//=> false
```
## Related
* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob)
* [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-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)
* [is-valid-glob](https://www.npmjs.com/package/is-valid-glob): Return true if a value is a valid glob pattern or patterns. | [homepage](https://github.com/jonschlinkert/is-valid-glob)
* [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)
## Run tests
Install dev dependencies:
```sh
$ npm i -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-glob/issues/new).
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright © 2015 Jon Schlinkert
Released under the MIT license.
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 02, 2015._

View File

@@ -0,0 +1,14 @@
/*!
* is-glob <https://github.com/jonschlinkert/is-glob>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
var isExtglob = require('is-extglob');
module.exports = function isGlob(str) {
return typeof str === 'string'
&& (/[*!?{}(|)[\]]/.test(str)
|| isExtglob(str));
};

View File

@@ -0,0 +1,88 @@
{
"_from": "is-glob@^2.0.1",
"_id": "is-glob@2.0.1",
"_inBundle": false,
"_integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=",
"_location": "/http-proxy-middleware/micromatch/is-glob",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "is-glob@^2.0.1",
"name": "is-glob",
"escapedName": "is-glob",
"rawSpec": "^2.0.1",
"saveSpec": null,
"fetchSpec": "^2.0.1"
},
"_requiredBy": [
"/http-proxy-middleware/micromatch"
],
"_resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz",
"_shasum": "d096f926a3ded5600f3fdfd91198cb0888c2d863",
"_spec": "is-glob@^2.0.1",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\http-proxy-middleware\\node_modules\\micromatch",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/is-glob/issues"
},
"bundleDependencies": false,
"dependencies": {
"is-extglob": "^1.0.0"
},
"deprecated": false,
"description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.",
"devDependencies": {
"mocha": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/is-glob",
"keywords": [
"bash",
"braces",
"check",
"exec",
"extglob",
"expression",
"glob",
"globbing",
"globstar",
"match",
"matches",
"pattern",
"regex",
"regular",
"string",
"test"
],
"license": "MIT",
"main": "index.js",
"name": "is-glob",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/is-glob.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"related": {
"list": [
"has-glob",
"is-extglob",
"is-posix-bracket",
"is-valid-glob",
"micromatch"
]
}
},
"version": "2.0.1"
}

View File

@@ -0,0 +1,145 @@
{
"_from": "micromatch@^2.3.11",
"_id": "micromatch@2.3.11",
"_inBundle": false,
"_integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=",
"_location": "/http-proxy-middleware/micromatch",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "micromatch@^2.3.11",
"name": "micromatch",
"escapedName": "micromatch",
"rawSpec": "^2.3.11",
"saveSpec": null,
"fetchSpec": "^2.3.11"
},
"_requiredBy": [
"/http-proxy-middleware"
],
"_resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz",
"_shasum": "86677c97d1720b363431d04d0d15293bd38c1565",
"_spec": "micromatch@^2.3.11",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\http-proxy-middleware",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/micromatch/issues"
},
"bundleDependencies": false,
"dependencies": {
"arr-diff": "^2.0.0",
"array-unique": "^0.2.1",
"braces": "^1.8.2",
"expand-brackets": "^0.1.4",
"extglob": "^0.3.1",
"filename-regex": "^2.0.0",
"is-extglob": "^1.0.0",
"is-glob": "^2.0.1",
"kind-of": "^3.0.2",
"normalize-path": "^2.0.1",
"object.omit": "^2.0.0",
"parse-glob": "^3.0.4",
"regex-cache": "^0.4.2"
},
"deprecated": false,
"description": "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.",
"devDependencies": {
"benchmarked": "^0.1.4",
"chalk": "^1.1.1",
"gulp": "^3.9.0",
"gulp-eslint": "^1.1.1",
"gulp-format-md": "^0.1.8",
"gulp-istanbul": "^0.10.1",
"gulp-mocha": "^2.1.3",
"minimatch": "^3.0.0",
"minimist": "^1.2.0",
"mocha": "^2",
"multimatch": "^2.0.0",
"should": "^8",
"write": "^0.2.1"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js",
"lib"
],
"homepage": "https://github.com/jonschlinkert/micromatch",
"keywords": [
"bash",
"expand",
"expansion",
"expression",
"file",
"files",
"filter",
"find",
"glob",
"globbing",
"globs",
"globstar",
"match",
"matcher",
"matches",
"matching",
"minimatch",
"multimatch",
"path",
"pattern",
"patterns",
"regex",
"regexp",
"regular",
"shell",
"wildcard"
],
"license": "MIT",
"main": "index.js",
"name": "micromatch",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/micromatch.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"related": {
"list": [
"braces",
"expand-brackets",
"expand-range",
"extglob",
"fill-range",
"gulp-micromatch",
"is-glob",
"parse-glob"
]
},
"reflinks": [
"braces",
"expand-brackets",
"extglob",
"minimatch",
"multimatch",
"verb"
],
"toc": false,
"layout": false,
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"lint": {
"reflinks": true
}
},
"version": "2.3.11"
}

100
node_modules/http-proxy-middleware/package.json generated vendored Normal file
View File

@@ -0,0 +1,100 @@
{
"_from": "http-proxy-middleware@~0.17.4",
"_id": "http-proxy-middleware@0.17.4",
"_inBundle": false,
"_integrity": "sha1-ZC6ISIUdZvCdTxJJEoRtuutBuDM=",
"_location": "/http-proxy-middleware",
"_phantomChildren": {
"arr-flatten": "1.1.0",
"expand-range": "1.8.2",
"filename-regex": "2.0.1",
"is-buffer": "1.1.6",
"is-extglob": "2.1.1",
"is-posix-bracket": "0.1.1",
"normalize-path": "2.1.1",
"object.omit": "2.0.1",
"parse-glob": "3.0.4",
"preserve": "0.2.0",
"regex-cache": "0.4.4",
"repeat-element": "1.1.3"
},
"_requested": {
"type": "range",
"registry": true,
"raw": "http-proxy-middleware@~0.17.4",
"name": "http-proxy-middleware",
"escapedName": "http-proxy-middleware",
"rawSpec": "~0.17.4",
"saveSpec": null,
"fetchSpec": "~0.17.4"
},
"_requiredBy": [
"/webpack-dev-server"
],
"_resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.17.4.tgz",
"_shasum": "642e8848851d66f09d4f124912846dbaeb41b833",
"_spec": "http-proxy-middleware@~0.17.4",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\webpack-dev-server",
"author": {
"name": "Steven Chim"
},
"bugs": {
"url": "https://github.com/chimurai/http-proxy-middleware/issues"
},
"bundleDependencies": false,
"dependencies": {
"http-proxy": "^1.16.2",
"is-glob": "^3.1.0",
"lodash": "^4.17.2",
"micromatch": "^2.3.11"
},
"deprecated": false,
"description": "The one-liner node.js proxy middleware for connect, express and browser-sync",
"devDependencies": {
"browser-sync": "^2.18.2",
"chai": "^3.5.0",
"connect": "^3.5.0",
"coveralls": "^2.11.15",
"express": "^4.14.0",
"istanbul": "^0.4.5",
"istanbul-coveralls": "^1.0.3",
"mocha": "^3.2.0",
"mocha-lcov-reporter": "1.2.0",
"opn": "^4.0.2",
"ws": "^1.1.1"
},
"files": [
"index.js",
"lib"
],
"homepage": "https://github.com/chimurai/http-proxy-middleware",
"keywords": [
"reverse",
"proxy",
"middleware",
"http",
"https",
"connect",
"express",
"browser-sync",
"gulp",
"grunt-contrib-connect",
"websocket",
"ws",
"cors"
],
"license": "MIT",
"main": "index.js",
"name": "http-proxy-middleware",
"repository": {
"type": "git",
"url": "git+https://github.com/chimurai/http-proxy-middleware.git"
},
"scripts": {
"clean": "rm -rf coverage",
"cover": "npm run clean && istanbul cover ./node_modules/mocha/bin/_mocha -- --recursive",
"coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- --recursive --reporter spec && istanbul-coveralls && npm run clean",
"test": "mocha --recursive --colors --reporter spec"
},
"version": "0.17.4"
}