summaryrefslogtreecommitdiffstats
path: root/node_modules/regexp-clone
diff options
context:
space:
mode:
authorGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
committerGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
commite06ec920f7a5d784e674c4c4b4e6d1da3dc7391d (patch)
tree55713f725f77b44ebfec86e4eec3ce33e71458ca /node_modules/regexp-clone
downloadwebsite_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.gz
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.bz2
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.zip
api, login, auth
Diffstat (limited to 'node_modules/regexp-clone')
-rw-r--r--node_modules/regexp-clone/.travis.yml14
-rw-r--r--node_modules/regexp-clone/History.md5
-rw-r--r--node_modules/regexp-clone/LICENSE22
-rw-r--r--node_modules/regexp-clone/Makefile5
-rw-r--r--node_modules/regexp-clone/README.md42
-rw-r--r--node_modules/regexp-clone/index.js27
-rw-r--r--node_modules/regexp-clone/package.json55
-rw-r--r--node_modules/regexp-clone/test/index.js171
8 files changed, 341 insertions, 0 deletions
diff --git a/node_modules/regexp-clone/.travis.yml b/node_modules/regexp-clone/.travis.yml
new file mode 100644
index 0000000..220a17b
--- /dev/null
+++ b/node_modules/regexp-clone/.travis.yml
@@ -0,0 +1,14 @@
+sudo: false
+language: node_js
+node_js:
+ - 8
+ - 10
+ - 12
+matrix:
+ include:
+ - node_js: "13"
+ env: "NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly"
+ allow_failures:
+ # Allow the nightly installs to fail
+ - env: "NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly"
+script: "npm test"
diff --git a/node_modules/regexp-clone/History.md b/node_modules/regexp-clone/History.md
new file mode 100644
index 0000000..0beedfc
--- /dev/null
+++ b/node_modules/regexp-clone/History.md
@@ -0,0 +1,5 @@
+
+0.0.1 / 2013-04-17
+==================
+
+ * initial commit
diff --git a/node_modules/regexp-clone/LICENSE b/node_modules/regexp-clone/LICENSE
new file mode 100644
index 0000000..98c7c89
--- /dev/null
+++ b/node_modules/regexp-clone/LICENSE
@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 2013 [Aaron Heckmann](aaron.heckmann+github@gmail.com)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/regexp-clone/Makefile b/node_modules/regexp-clone/Makefile
new file mode 100644
index 0000000..6c8fb75
--- /dev/null
+++ b/node_modules/regexp-clone/Makefile
@@ -0,0 +1,5 @@
+
+test:
+ @./node_modules/.bin/mocha $(T) --async-only $(TESTS)
+
+.PHONY: test
diff --git a/node_modules/regexp-clone/README.md b/node_modules/regexp-clone/README.md
new file mode 100644
index 0000000..4a16bad
--- /dev/null
+++ b/node_modules/regexp-clone/README.md
@@ -0,0 +1,42 @@
+#regexp-clone
+==============
+
+Clones RegExps with flag and `lastIndex` preservation.
+
+```js
+const regexpClone = require('regexp-clone');
+
+const a = /somethin/misguy;
+console.log(a.global); // true
+console.log(a.ignoreCase); // true
+console.log(a.multiline); // true
+console.log(a.dotAll); // true
+console.log(a.unicode); // true
+console.log(a.sticky); // true
+
+const b = regexpClone(a);
+console.log(b.global); // true
+console.log(b.ignoreCase); // true
+console.log(b.multiline); // true
+console.log(b.dotAll); // true
+console.log(b.unicode); // true
+console.log(b.sticky); // true
+
+const c = /hi/g;
+c.test('this string hi there');
+assert.strictEqual(c.lastIndex, 3);
+
+const d = regexpClone(c);
+assert.strictEqual(d.lastIndex, 3);
+d.test('this string hi there');
+assert.strictEqual(d.lastIndex, 14);
+assert.strictEqual(c.lastIndex, 3);
+```
+
+```
+npm install regexp-clone
+```
+
+## License
+
+[MIT](https://github.com/aheckmann/regexp-clone/blob/master/LICENSE)
diff --git a/node_modules/regexp-clone/index.js b/node_modules/regexp-clone/index.js
new file mode 100644
index 0000000..19512b3
--- /dev/null
+++ b/node_modules/regexp-clone/index.js
@@ -0,0 +1,27 @@
+
+const toString = Object.prototype.toString;
+
+function isRegExp (o) {
+ return 'object' == typeof o
+ && '[object RegExp]' == toString.call(o);
+}
+
+module.exports = exports = function (regexp) {
+ if (!isRegExp(regexp)) {
+ throw new TypeError('Not a RegExp');
+ }
+
+ const flags = [];
+ if (regexp.global) flags.push('g');
+ if (regexp.multiline) flags.push('m');
+ if (regexp.ignoreCase) flags.push('i');
+ if (regexp.dotAll) flags.push('s');
+ if (regexp.unicode) flags.push('u');
+ if (regexp.sticky) flags.push('y');
+ const result = new RegExp(regexp.source, flags.join(''));
+ if (typeof regexp.lastIndex === 'number') {
+ result.lastIndex = regexp.lastIndex;
+ }
+ return result;
+}
+
diff --git a/node_modules/regexp-clone/package.json b/node_modules/regexp-clone/package.json
new file mode 100644
index 0000000..c63c7cf
--- /dev/null
+++ b/node_modules/regexp-clone/package.json
@@ -0,0 +1,55 @@
+{
+ "_from": "regexp-clone@1.0.0",
+ "_id": "regexp-clone@1.0.0",
+ "_inBundle": false,
+ "_integrity": "sha512-TuAasHQNamyyJ2hb97IuBEif4qBHGjPHBS64sZwytpLEqtBQ1gPJTnOaQ6qmpET16cK14kkjbazl6+p0RRv0yw==",
+ "_location": "/regexp-clone",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "regexp-clone@1.0.0",
+ "name": "regexp-clone",
+ "escapedName": "regexp-clone",
+ "rawSpec": "1.0.0",
+ "saveSpec": null,
+ "fetchSpec": "1.0.0"
+ },
+ "_requiredBy": [
+ "/mongoose",
+ "/mquery"
+ ],
+ "_resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-1.0.0.tgz",
+ "_shasum": "222db967623277056260b992626354a04ce9bf63",
+ "_spec": "regexp-clone@1.0.0",
+ "_where": "/home/pruss/Dev/3-minute-website/node_modules/mongoose",
+ "author": {
+ "name": "Aaron Heckmann",
+ "email": "aaron.heckmann+github@gmail.com"
+ },
+ "bugs": {
+ "url": "https://github.com/aheckmann/regexp-clone/issues"
+ },
+ "bundleDependencies": false,
+ "deprecated": false,
+ "description": "Clone RegExps with options",
+ "devDependencies": {
+ "mocha": "^6.1.4"
+ },
+ "homepage": "https://github.com/aheckmann/regexp-clone#readme",
+ "keywords": [
+ "RegExp",
+ "clone"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "name": "regexp-clone",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/aheckmann/regexp-clone.git"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "version": "1.0.0"
+}
diff --git a/node_modules/regexp-clone/test/index.js b/node_modules/regexp-clone/test/index.js
new file mode 100644
index 0000000..ceaea28
--- /dev/null
+++ b/node_modules/regexp-clone/test/index.js
@@ -0,0 +1,171 @@
+
+const assert = require('assert')
+const clone = require('../');
+
+describe('regexp-clone', function(){
+ function hasEqualSource (a, b) {
+ assert.ok(a !== b);
+ assert.equal(a.source, b.source);
+ }
+
+ function isIgnoreCase (a) {
+ assert.ok(a.ignoreCase);
+ }
+
+ function isGlobal (a) {
+ assert.ok(a.global);
+ }
+
+ function isMultiline (a) {
+ assert.ok(a.multiline);
+ }
+
+ function isDotAll (a) {
+ assert.ok(a.dotAll);
+ }
+
+ function isUnicode (a) {
+ assert.ok(a.unicode);
+ }
+
+ function isSticky(a) {
+ assert.ok(a.sticky);
+ }
+
+ function testFlag (a, method) {
+ const b = clone(a);
+ hasEqualSource(a, b);
+ method(a);
+ method(b);
+ }
+
+ function lastIndex(a) {
+ a.test('this string hi there');
+ assert.strictEqual(a.lastIndex, 3);
+ const b = clone(a);
+ assert.strictEqual(b.lastIndex, 3);
+ assert.strictEqual(a.lastIndex, 3);
+ b.test('this string hi there');
+ assert.strictEqual(b.lastIndex, 14);
+ assert.strictEqual(a.lastIndex, 3);
+ }
+
+ function allFlags(a) {
+ const b = clone(a);
+ hasEqualSource(a, b);
+ testFlag(b, isIgnoreCase);
+ testFlag(b, isGlobal);
+ testFlag(b, isMultiline);
+ testFlag(b, isDotAll);
+ testFlag(b, isUnicode);
+ testFlag(b, isSticky);
+ }
+
+ function noFlags(a) {
+ const b = clone(a);
+ hasEqualSource(a, b);
+ assert.ok(!b.ignoreCase);
+ assert.ok(!b.global);
+ assert.ok(!b.multiline);
+ assert.ok(!b.dotAll);
+ assert.ok(!b.unicode);
+ assert.ok(!b.sticky);
+ }
+
+ describe('literals', function(){
+ it('ignoreCase flag', function(done){
+ const a = /hello/i;
+ testFlag(a, isIgnoreCase);
+ done();
+ })
+ it('global flag', function(done){
+ const a = /hello/g;
+ testFlag(a, isGlobal);
+ done();
+ })
+ it('multiline flag', function(done){
+ const a = /hello/m;
+ testFlag(a, isMultiline);
+ done();
+ })
+ it('dotAll flag', function(done){
+ const a = /hello/s;
+ testFlag(a, isDotAll);
+ done();
+ })
+ it('unicode flag', function(done){
+ const a = /hello/u;
+ testFlag(a, isUnicode);
+ done();
+ })
+ it('sticky flag', function(done){
+ const a = /hello/y;
+ testFlag(a, isSticky);
+ done();
+ })
+ it('no flags', function(done){
+ const a = /hello/;
+ noFlags(a);
+ done();
+ })
+ it('all flags', function(done){
+ const a = /hello/gimsuy;
+ allFlags(a);
+ done();
+ })
+ it('lastIndex', function(done) {
+ const a = /hi/g;
+ lastIndex(a);
+ done();
+ })
+ })
+
+ describe('instances', function(){
+ it('ignoreCase flag', function(done){
+ const a = new RegExp('hello', 'i');
+ testFlag(a, isIgnoreCase);
+ done();
+ })
+ it('global flag', function(done){
+ const a = new RegExp('hello', 'g');
+ testFlag(a, isGlobal);
+ done();
+ })
+ it('multiline flag', function(done){
+ const a = new RegExp('hello', 'm');
+ testFlag(a, isMultiline);
+ done();
+ })
+ it('dotAll flag', function(done){
+ const a = new RegExp('hello', 's');
+ testFlag(a, isDotAll);
+ done();
+ })
+ it('unicode flag', function(done){
+ const a = new RegExp('hello', 'u');
+ testFlag(a, isUnicode);
+ done();
+ })
+ it('sticky flag', function(done){
+ const a = new RegExp('hello', 'y');
+ testFlag(a, isSticky);
+ done();
+ })
+ it('no flags', function(done){
+ const a = new RegExp('hmm');
+ noFlags(a);
+ done();
+ })
+ it('all flags', function(done){
+ const a = new RegExp('hello', 'misguy');
+ allFlags(a);
+ done();
+ })
+ it('lastIndex', function(done) {
+ const a = new RegExp('hi', 'g');
+ lastIndex(a);
+ done();
+ })
+ })
+})
+