Initial pass

This commit is contained in:
Danny McCormick
2019-06-26 21:12:00 -04:00
commit 39c08a0eaa
7242 changed files with 1886006 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016-2018, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
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.
+205
View File
File diff suppressed because one or more lines are too long
+155
View File
@@ -0,0 +1,155 @@
'use strict';
var safe = require('safe-regex');
var define = require('define-property');
var extend = require('extend-shallow');
var not = require('regex-not');
var MAX_LENGTH = 1024 * 64;
/**
* Session cache
*/
var cache = {};
/**
* Create a regular expression from the given `pattern` string.
*
* @param {String|RegExp} `pattern` Pattern can be a string or regular expression.
* @param {Object} `options`
* @return {RegExp}
* @api public
*/
module.exports = function(patterns, options) {
if (!Array.isArray(patterns)) {
return makeRe(patterns, options);
}
return makeRe(patterns.join('|'), options);
};
/**
* Create a regular expression from the given `pattern` string.
*
* @param {String|RegExp} `pattern` Pattern can be a string or regular expression.
* @param {Object} `options`
* @return {RegExp}
* @api public
*/
function makeRe(pattern, options) {
if (pattern instanceof RegExp) {
return pattern;
}
if (typeof pattern !== 'string') {
throw new TypeError('expected a string');
}
if (pattern.length > MAX_LENGTH) {
throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
}
var key = pattern;
// do this before shallow cloning options, it's a lot faster
if (!options || (options && options.cache !== false)) {
key = createKey(pattern, options);
if (cache.hasOwnProperty(key)) {
return cache[key];
}
}
var opts = extend({}, options);
if (opts.contains === true) {
if (opts.negate === true) {
opts.strictNegate = false;
} else {
opts.strict = false;
}
}
if (opts.strict === false) {
opts.strictOpen = false;
opts.strictClose = false;
}
var open = opts.strictOpen !== false ? '^' : '';
var close = opts.strictClose !== false ? '$' : '';
var flags = opts.flags || '';
var regex;
if (opts.nocase === true && !/i/.test(flags)) {
flags += 'i';
}
try {
if (opts.negate || typeof opts.strictNegate === 'boolean') {
pattern = not.create(pattern, opts);
}
var str = open + '(?:' + pattern + ')' + close;
regex = new RegExp(str, flags);
if (opts.safe === true && safe(regex) === false) {
throw new Error('potentially unsafe regular expression: ' + regex.source);
}
} catch (err) {
if (opts.strictErrors === true || opts.safe === true) {
err.key = key;
err.pattern = pattern;
err.originalOptions = options;
err.createdOptions = opts;
throw err;
}
try {
regex = new RegExp('^' + pattern.replace(/(\W)/g, '\\$1') + '$');
} catch (err) {
regex = /.^/; //<= match nothing
}
}
if (opts.cache !== false) {
memoize(regex, key, pattern, opts);
}
return regex;
}
/**
* Memoize generated regex. This can result in dramatic speed improvements
* and simplify debugging by adding options and pattern to the regex. It can be
* disabled by passing setting `options.cache` to false.
*/
function memoize(regex, key, pattern, options) {
define(regex, 'cached', true);
define(regex, 'pattern', pattern);
define(regex, 'options', options);
define(regex, 'key', key);
cache[key] = regex;
}
/**
* Create the key to use for memoization. The key is generated
* by iterating over the options and concatenating key-value pairs
* to the pattern string.
*/
function createKey(pattern, options) {
if (!options) return pattern;
var key = pattern;
for (var prop in options) {
if (options.hasOwnProperty(prop)) {
key += ';' + prop + '=' + String(options[prop]);
}
}
return key;
}
/**
* Expose `makeRe`
*/
module.exports.makeRe = makeRe;
+101
View File
@@ -0,0 +1,101 @@
{
"_args": [
[
"[email protected]",
"C:\\Users\\Administrator\\Documents\\setup-python"
]
],
"_development": true,
"_from": "[email protected]",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==",
"_location": "/to-regex",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "[email protected]",
"name": "to-regex",
"escapedName": "to-regex",
"rawSpec": "3.0.2",
"saveSpec": null,
"fetchSpec": "3.0.2"
},
"_requiredBy": [
"/braces",
"/expand-brackets",
"/extglob",
"/micromatch",
"/nanomatch"
],
"_resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz",
"_spec": "3.0.2",
"_where": "C:\\Users\\Administrator\\Documents\\setup-python",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/to-regex/issues"
},
"dependencies": {
"define-property": "^2.0.2",
"extend-shallow": "^3.0.2",
"regex-not": "^1.0.2",
"safe-regex": "^1.1.0"
},
"description": "Generate a regex from a string or array of strings.",
"devDependencies": {
"gulp-format-md": "^1.0.0",
"mocha": "^3.5.3"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/to-regex",
"keywords": [
"match",
"regex",
"regular expression",
"test",
"to"
],
"license": "MIT",
"main": "index.js",
"name": "to-regex",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/to-regex.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"toc": {
"method": "preWrite"
},
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"related": {
"list": [
"has-glob",
"is-glob",
"path-regex",
"to-regex-range"
]
},
"lint": {
"reflinks": true
}
},
"version": "3.0.2"
}