Initial commit
This commit is contained in:
14
node_modules/regexp-clone/.travis.yml
generated
vendored
Normal file
14
node_modules/regexp-clone/.travis.yml
generated
vendored
Normal file
@@ -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"
|
||||
5
node_modules/regexp-clone/History.md
generated
vendored
Normal file
5
node_modules/regexp-clone/History.md
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
0.0.1 / 2013-04-17
|
||||
==================
|
||||
|
||||
* initial commit
|
||||
22
node_modules/regexp-clone/LICENSE
generated
vendored
Normal file
22
node_modules/regexp-clone/LICENSE
generated
vendored
Normal file
@@ -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.
|
||||
5
node_modules/regexp-clone/Makefile
generated
vendored
Normal file
5
node_modules/regexp-clone/Makefile
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
test:
|
||||
@./node_modules/.bin/mocha $(T) --async-only $(TESTS)
|
||||
|
||||
.PHONY: test
|
||||
42
node_modules/regexp-clone/README.md
generated
vendored
Normal file
42
node_modules/regexp-clone/README.md
generated
vendored
Normal file
@@ -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)
|
||||
27
node_modules/regexp-clone/index.js
generated
vendored
Normal file
27
node_modules/regexp-clone/index.js
generated
vendored
Normal file
@@ -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;
|
||||
}
|
||||
|
||||
55
node_modules/regexp-clone/package.json
generated
vendored
Normal file
55
node_modules/regexp-clone/package.json
generated
vendored
Normal file
@@ -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": "C:\\Users\\anelissen.DOMAINE\\Development\\tools\\node\\cbor\\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"
|
||||
}
|
||||
171
node_modules/regexp-clone/test/index.js
generated
vendored
Normal file
171
node_modules/regexp-clone/test/index.js
generated
vendored
Normal file
@@ -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();
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user