This commit is contained in:
Stephen Franceschelli 2019-07-30 13:41:05 -04:00
parent 596a6da241
commit c1a589c5b6
7078 changed files with 1882834 additions and 319 deletions

9
node_modules/is-regex/.eslintrc generated vendored Normal file
View file

@ -0,0 +1,9 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"id-length": [1]
}
}

176
node_modules/is-regex/.jscs.json generated vendored Normal file
View file

@ -0,0 +1,176 @@
{
"es3": true,
"additionalRules": [],
"requireSemicolons": true,
"disallowMultipleSpaces": true,
"disallowIdentifierNames": [],
"requireCurlyBraces": {
"allExcept": [],
"keywords": ["if", "else", "for", "while", "do", "try", "catch"]
},
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"],
"disallowSpaceAfterKeywords": [],
"disallowSpaceBeforeComma": true,
"disallowSpaceAfterComma": false,
"disallowSpaceBeforeSemicolon": true,
"disallowNodeTypes": [
"DebuggerStatement",
"ForInStatement",
"LabeledStatement",
"SwitchCase",
"SwitchStatement",
"WithStatement"
],
"requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] },
"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },
"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true },
"disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true },
"requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true },
"disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true },
"requireSpaceBetweenArguments": true,
"disallowSpacesInsideParentheses": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowQuotedKeysInObjects": { "allExcept": ["reserved"] },
"disallowSpaceAfterObjectKeys": true,
"requireCommaBeforeLineBreak": true,
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
"requireSpaceAfterPrefixUnaryOperators": [],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
"requireSpaceBeforePostfixUnaryOperators": [],
"disallowSpaceBeforeBinaryOperators": [],
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
"disallowSpaceAfterBinaryOperators": [],
"disallowImplicitTypeConversion": ["binary", "string"],
"disallowKeywords": ["with", "eval"],
"requireKeywordsOnNewLine": [],
"disallowKeywordsOnNewLine": ["else"],
"requireLineFeedAtFileEnd": true,
"disallowTrailingWhitespace": true,
"disallowTrailingComma": true,
"excludeFiles": ["node_modules/**", "vendor/**"],
"disallowMultipleLineStrings": true,
"requireDotNotation": { "allExcept": ["keywords"] },
"requireParenthesesAroundIIFE": true,
"validateLineBreaks": "LF",
"validateQuoteMarks": {
"escape": true,
"mark": "'"
},
"disallowOperatorBeforeLineBreak": [],
"requireSpaceBeforeKeywords": [
"do",
"for",
"if",
"else",
"switch",
"case",
"try",
"catch",
"finally",
"while",
"with",
"return"
],
"validateAlignedFunctionParameters": {
"lineBreakAfterOpeningBraces": true,
"lineBreakBeforeClosingBraces": true
},
"requirePaddingNewLinesBeforeExport": true,
"validateNewlineAfterArrayElements": {
"maximum": 1
},
"requirePaddingNewLinesAfterUseStrict": true,
"disallowArrowFunctions": true,
"disallowMultiLineTernary": true,
"validateOrderInObjectKeys": "asc-insensitive",
"disallowIdenticalDestructuringNames": true,
"disallowNestedTernaries": { "maxLevel": 1 },
"requireSpaceAfterComma": { "allExcept": ["trailing"] },
"requireAlignedMultilineParams": false,
"requireSpacesInGenerator": {
"afterStar": true
},
"disallowSpacesInGenerator": {
"beforeStar": true
},
"disallowVar": false,
"requireArrayDestructuring": false,
"requireEnhancedObjectLiterals": false,
"requireObjectDestructuring": false,
"requireEarlyReturn": false,
"requireCapitalizedConstructorsNew": {
"allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"]
},
"requireImportAlphabetized": false,
"requireSpaceBeforeObjectValues": true,
"requireSpaceBeforeDestructuredValues": true,
"disallowSpacesInsideTemplateStringPlaceholders": true,
"disallowArrayDestructuringReturn": false,
"requireNewlineBeforeSingleStatementsInIf": false,
"disallowUnusedVariables": true,
"requireSpacesInsideImportedObjectBraces": true,
"requireUseStrict": true
}

15
node_modules/is-regex/.npmignore generated vendored Normal file
View file

@ -0,0 +1,15 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
npm-debug.log
node_modules

165
node_modules/is-regex/.travis.yml generated vendored Normal file
View file

@ -0,0 +1,165 @@
language: node_js
os:
- linux
node_js:
- "7.5"
- "6.9"
- "5.12"
- "4.7"
- "iojs-v3.3"
- "iojs-v2.5"
- "iojs-v1.8"
- "0.12"
- "0.10"
- "0.8"
before_install:
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi'
- 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi'
script:
- 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi'
- 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi'
- 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi'
- 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi'
sudo: false
env:
- TEST=true
matrix:
fast_finish: true
include:
- node_js: "node"
env: PRETEST=true
- node_js: "node"
env: POSTTEST=true
- node_js: "7.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.8"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.7"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.5"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "6.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.11"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.10"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.9"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.8"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.7"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.5"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "5.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.5"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "4.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v3.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v3.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v3.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v2.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v2.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v2.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v2.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v2.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.7"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.5"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.3"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.2"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.1"
env: TEST=true ALLOW_FAILURE=true
- node_js: "iojs-v1.0"
env: TEST=true ALLOW_FAILURE=true
- node_js: "0.11"
env: TEST=true ALLOW_FAILURE=true
- node_js: "0.9"
env: TEST=true ALLOW_FAILURE=true
- node_js: "0.6"
env: TEST=true ALLOW_FAILURE=true
- node_js: "0.4"
env: TEST=true ALLOW_FAILURE=true
- node_js: "7"
env: TEST=true
os: osx
- node_js: "6"
env: TEST=true
os: osx
- node_js: "5"
env: TEST=true
os: osx
- node_js: "4"
env: TEST=true
os: osx
- node_js: "iojs"
env: TEST=true
os: osx
- node_js: "0.12"
env: TEST=true
os: osx
- node_js: "0.10"
env: TEST=true
os: osx
- node_js: "0.8"
env: TEST=true
os: osx
allow_failures:
- os: osx
- env: TEST=true ALLOW_FAILURE=true

27
node_modules/is-regex/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,27 @@
1.0.4 / 2016-02-18
=================
* [Fix] ensure that `lastIndex` is not mutated (#3)
* [Refactor] when try/catch is needed, bail early if the value lacks an own `lastIndex` data property
* [Refactor] use an early return instead of a ternary
* [Refactor] bail earlier when the value is falsy
* Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG
* [Dev Deps] update `tape`, `jscs`, `editorconfig-tools`, `eslint`, `semver`, `replace`, `nsp`, `covert`, `@ljharb/eslint-config`
* [Tests] on all the node and io.js versions; improve test matri
* [Tests] Fix tests for faked @@toStringTag
1.0.3 / 2015-01-29
=================
* If @@toStringTag is not present, use the old-school Object#toString test.
1.0.2 / 2015-01-29
=================
* Improve optimization by separating the try/catch, and bailing out early when not typeof "object".
1.0.1 / 2015-01-28
=================
* Update `jscs`, `tape`, `covert`
* Use RegExp#exec to test if something is a regex, which works even with ES6 @@toStringTag.
1.0.0 / 2014-05-19
=================
* Initial release.

20
node_modules/is-regex/LICENSE generated vendored Normal file
View file

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

61
node_modules/is-regex/Makefile generated vendored Normal file
View file

@ -0,0 +1,61 @@
# Since we rely on paths relative to the makefile location, abort if make isn't being run from there.
$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in))
# The files that need updating when incrementing the version number.
VERSIONED_FILES := *.js *.json README*
# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly.
# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment
# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests.
export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH")
UTILS := semver
# Make sure that all required utilities can be located.
UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS)))
# Default target (by virtue of being the first non '.'-prefixed in the file).
.PHONY: _no-target-specified
_no-target-specified:
$(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests)
# Lists all targets defined in this makefile.
.PHONY: list
list:
@$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort
# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS).
.PHONY: test
test:
@npm test
.PHONY: _ensure-tag
_ensure-tag:
ifndef TAG
$(error Please invoke with `make TAG=<new-version> release`, where <new-version> is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number)
endif
CHANGELOG_ERROR = $(error No CHANGELOG specified)
.PHONY: _ensure-changelog
_ensure-changelog:
@ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2)
# Ensures that the git workspace is clean.
.PHONY: _ensure-clean
_ensure-clean:
@[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; }
# Makes a release; invoke with `make TAG=<versionOrIncrementSpec> release`.
.PHONY: release
release: _ensure-tag _ensure-changelog _ensure-clean
@old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \
new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \
if printf "$$new_ver" | command grep -q '^[0-9]'; then \
semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \
semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \
else \
new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \
fi; \
printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \
replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \
git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \
git tag -a -m "v$$new_ver" "v$$new_ver"

54
node_modules/is-regex/README.md generated vendored Normal file
View file

@ -0,0 +1,54 @@
#is-regex <sup>[![Version Badge][2]][1]</sup>
[![Build Status][3]][4]
[![dependency status][5]][6]
[![dev dependency status][7]][8]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][11]][1]
[![browser support][9]][10]
Is this value a JS regex?
This module works cross-realm/iframe, and despite ES6 @@toStringTag.
## Example
```js
var isRegex = require('is-regex');
var assert = require('assert');
assert.notOk(isRegex(undefined));
assert.notOk(isRegex(null));
assert.notOk(isRegex(false));
assert.notOk(isRegex(true));
assert.notOk(isRegex(42));
assert.notOk(isRegex('foo'));
assert.notOk(isRegex(function () {}));
assert.notOk(isRegex([]));
assert.notOk(isRegex({}));
assert.ok(isRegex(/a/g));
assert.ok(isRegex(new RegExp('a', 'g')));
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[1]: https://npmjs.org/package/is-regex
[2]: http://versionbadg.es/ljharb/is-regex.svg
[3]: https://travis-ci.org/ljharb/is-regex.svg
[4]: https://travis-ci.org/ljharb/is-regex
[5]: https://david-dm.org/ljharb/is-regex.svg
[6]: https://david-dm.org/ljharb/is-regex
[7]: https://david-dm.org/ljharb/is-regex/dev-status.svg
[8]: https://david-dm.org/ljharb/is-regex#info=devDependencies
[9]: https://ci.testling.com/ljharb/is-regex.png
[10]: https://ci.testling.com/ljharb/is-regex
[11]: https://nodei.co/npm/is-regex.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/is-regex.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/is-regex.svg
[downloads-url]: http://npm-stat.com/charts.html?package=is-regex

39
node_modules/is-regex/index.js generated vendored Normal file
View file

@ -0,0 +1,39 @@
'use strict';
var has = require('has');
var regexExec = RegExp.prototype.exec;
var gOPD = Object.getOwnPropertyDescriptor;
var tryRegexExecCall = function tryRegexExec(value) {
try {
var lastIndex = value.lastIndex;
value.lastIndex = 0;
regexExec.call(value);
return true;
} catch (e) {
return false;
} finally {
value.lastIndex = lastIndex;
}
};
var toStr = Object.prototype.toString;
var regexClass = '[object RegExp]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
module.exports = function isRegex(value) {
if (!value || typeof value !== 'object') {
return false;
}
if (!hasToStringTag) {
return toStr.call(value) === regexClass;
}
var descriptor = gOPD(value, 'lastIndex');
var hasLastIndexDataProperty = descriptor && has(descriptor, 'value');
if (!hasLastIndexDataProperty) {
return false;
}
return tryRegexExecCall(value);
};

100
node_modules/is-regex/package.json generated vendored Normal file
View file

@ -0,0 +1,100 @@
{
"_from": "is-regex@^1.0.4",
"_id": "is-regex@1.0.4",
"_inBundle": false,
"_integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
"_location": "/is-regex",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "is-regex@^1.0.4",
"name": "is-regex",
"escapedName": "is-regex",
"rawSpec": "^1.0.4",
"saveSpec": null,
"fetchSpec": "^1.0.4"
},
"_requiredBy": [
"/es-abstract"
],
"_resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
"_shasum": "5517489b547091b0930e095654ced25ee97e9491",
"_spec": "is-regex@^1.0.4",
"_where": "E:\\github\\setup-java\\node_modules\\es-abstract",
"author": {
"name": "Jordan Harband"
},
"bugs": {
"url": "https://github.com/ljharb/is-regex/issues"
},
"bundleDependencies": false,
"dependencies": {
"has": "^1.0.1"
},
"deprecated": false,
"description": "Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag",
"devDependencies": {
"@ljharb/eslint-config": "^11.0.0",
"covert": "^1.1.0",
"editorconfig-tools": "^0.1.1",
"eslint": "^3.15.0",
"jscs": "^3.0.7",
"nsp": "^2.6.2",
"replace": "^0.3.0",
"semver": "^5.3.0",
"tape": "^4.6.3"
},
"engines": {
"node": ">= 0.4"
},
"homepage": "https://github.com/ljharb/is-regex",
"keywords": [
"regex",
"regexp",
"is",
"regular expression",
"regular",
"expression"
],
"license": "MIT",
"main": "index.js",
"name": "is-regex",
"repository": {
"type": "git",
"url": "git://github.com/ljharb/is-regex.git"
},
"scripts": {
"coverage": "covert test.js",
"coverage-quiet": "covert test.js --quiet",
"eccheck": "editorconfig-tools check *.js **/*.js > /dev/null",
"eslint": "eslint test.js *.js",
"jscs": "jscs *.js",
"lint": "npm run jscs && npm run eslint",
"posttest": "npm run security",
"pretest": "npm run lint",
"security": "nsp check",
"test": "npm run tests-only",
"tests-only": "node --harmony --es-staging test.js"
},
"testling": {
"files": "test.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/10.0..12.0",
"opera/15.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"version": "1.0.4"
}

58
node_modules/is-regex/test.js generated vendored Normal file
View file

@ -0,0 +1,58 @@
'use strict';
var test = require('tape');
var isRegex = require('./');
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
test('not regexes', function (t) {
t.notOk(isRegex(), 'undefined is not regex');
t.notOk(isRegex(null), 'null is not regex');
t.notOk(isRegex(false), 'false is not regex');
t.notOk(isRegex(true), 'true is not regex');
t.notOk(isRegex(42), 'number is not regex');
t.notOk(isRegex('foo'), 'string is not regex');
t.notOk(isRegex([]), 'array is not regex');
t.notOk(isRegex({}), 'object is not regex');
t.notOk(isRegex(function () {}), 'function is not regex');
t.end();
});
test('@@toStringTag', { skip: !hasToStringTag }, function (t) {
var regex = /a/g;
var fakeRegex = {
toString: function () { return String(regex); },
valueOf: function () { return regex; }
};
fakeRegex[Symbol.toStringTag] = 'RegExp';
t.notOk(isRegex(fakeRegex), 'fake RegExp with @@toStringTag "RegExp" is not regex');
t.end();
});
test('regexes', function (t) {
t.ok(isRegex(/a/g), 'regex literal is regex');
t.ok(isRegex(new RegExp('a', 'g')), 'regex object is regex');
t.end();
});
test('does not mutate regexes', function (t) {
t.test('lastIndex is a marker object', function (st) {
var regex = /a/;
var marker = {};
regex.lastIndex = marker;
st.equal(regex.lastIndex, marker, 'lastIndex is the marker object');
st.ok(isRegex(regex), 'is regex');
st.equal(regex.lastIndex, marker, 'lastIndex is the marker object after isRegex');
st.end();
});
t.test('lastIndex is nonzero', function (st) {
var regex = /a/;
regex.lastIndex = 3;
st.equal(regex.lastIndex, 3, 'lastIndex is 3');
st.ok(isRegex(regex), 'is regex');
st.equal(regex.lastIndex, 3, 'lastIndex is 3 after isRegex');
st.end();
});
t.end();
});