routie dev init since i didn't adhere to any proper guidance up until now

This commit is contained in:
2026-04-29 22:27:29 -06:00
commit e1dabb71e2
15301 changed files with 3562618 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
'use strict';
const escapeStringRegexp = require('escape-string-regexp');
const mapping = require('./lib/mappings');
const hasFlags = (regexFlags, replaceFlags) => {
if (!replaceFlags) {
return true;
}
// Check if every flag in the replace flags is part of the original regex flags
return replaceFlags.split('').every(flag => regexFlags.includes(flag));
};
module.exports = (regexp, flags) => {
flags = flags || '';
if (typeof regexp !== 'string') {
throw new TypeError(`Expected regexp to be of type \`string\`, got \`${typeof regexp}\``);
}
if (typeof flags !== 'string') {
throw new TypeError(`Expected flags to be of type \`string\`, got \`${typeof flags}\``);
}
for (const replace of mapping) {
const key = replace[0];
const replacement = replace[1];
if (hasFlags(flags, replacement.flags)) {
regexp = regexp.replace(new RegExp(escapeStringRegexp(key), 'g'), replacement.value);
}
}
return regexp;
};
+143
View File
@@ -0,0 +1,143 @@
'use strict';
module.exports = new Map([
['[0-9]', {value: '\\d'}],
['[^0-9]', {value: '\\D'}],
// Word
['[a-zA-Z0-9_]', {value: '\\w'}],
['[a-zA-Z_0-9]', {value: '\\w'}],
['[a-z0-9A-Z_]', {value: '\\w'}],
['[a-z0-9_A-Z]', {value: '\\w'}],
['[a-z_A-Z0-9]', {value: '\\w'}],
['[a-z_0-9A-Z]', {value: '\\w'}],
['[A-Za-z0-9_]', {value: '\\w'}],
['[A-Za-z_0-9]', {value: '\\w'}],
['[A-Z0-9a-z_]', {value: '\\w'}],
['[A-Z0-9_a-z]', {value: '\\w'}],
['[A-Z_a-z0-9]', {value: '\\w'}],
['[A-Z_0-9a-z]', {value: '\\w'}],
['[0-9a-zA-Z_]', {value: '\\w'}],
['[0-9a-z_A-Z]', {value: '\\w'}],
['[0-9A-Za-z_]', {value: '\\w'}],
['[0-9A-Z_a-z]', {value: '\\w'}],
['[0-9_a-zA-Z]', {value: '\\w'}],
['[0-9_A-Za-z]', {value: '\\w'}],
['[_a-zA-Z0-9]', {value: '\\w'}],
['[_a-z0-9A-Z]', {value: '\\w'}],
['[_A-Za-z0-9]', {value: '\\w'}],
['[_A-Z0-9a-z]', {value: '\\w'}],
['[_0-9a-zA-Z]', {value: '\\w'}],
['[_0-9A-Za-z]', {value: '\\w'}],
// Word with digit
['[a-zA-Z\\d_]', {value: '\\w'}],
['[a-zA-Z_\\d]', {value: '\\w'}],
['[a-z\\dA-Z_]', {value: '\\w'}],
['[a-z\\d_A-Z]', {value: '\\w'}],
['[a-z_A-Z\\d]', {value: '\\w'}],
['[a-z_\\dA-Z]', {value: '\\w'}],
['[A-Za-z\\d_]', {value: '\\w'}],
['[A-Za-z_\\d]', {value: '\\w'}],
['[A-Z\\da-z_]', {value: '\\w'}],
['[A-Z\\d_a-z]', {value: '\\w'}],
['[A-Z_a-z\\d]', {value: '\\w'}],
['[A-Z_\\da-z]', {value: '\\w'}],
['[\\da-zA-Z_]', {value: '\\w'}],
['[\\da-z_A-Z]', {value: '\\w'}],
['[\\dA-Za-z_]', {value: '\\w'}],
['[\\dA-Z_a-z]', {value: '\\w'}],
['[\\d_a-zA-Z]', {value: '\\w'}],
['[\\d_A-Za-z]', {value: '\\w'}],
['[_a-zA-Z\\d]', {value: '\\w'}],
['[_a-z\\dA-Z]', {value: '\\w'}],
['[_A-Za-z\\d]', {value: '\\w'}],
['[_A-Z\\da-z]', {value: '\\w'}],
['[_\\da-zA-Z]', {value: '\\w'}],
['[_\\dA-Za-z]', {value: '\\w'}],
// Non-word
['[^a-zA-Z0-9_]', {value: '\\W'}],
['[^a-zA-Z_0-9]', {value: '\\W'}],
['[^a-z0-9A-Z_]', {value: '\\W'}],
['[^a-z0-9_A-Z]', {value: '\\W'}],
['[^a-z_A-Z0-9]', {value: '\\W'}],
['[^a-z_0-9A-Z]', {value: '\\W'}],
['[^A-Za-z0-9_]', {value: '\\W'}],
['[^A-Za-z_0-9]', {value: '\\W'}],
['[^A-Z0-9a-z_]', {value: '\\W'}],
['[^A-Z0-9_a-z]', {value: '\\W'}],
['[^A-Z_a-z0-9]', {value: '\\W'}],
['[^A-Z_0-9a-z]', {value: '\\W'}],
['[^0-9a-zA-Z_]', {value: '\\W'}],
['[^0-9a-z_A-Z]', {value: '\\W'}],
['[^0-9A-Za-z_]', {value: '\\W'}],
['[^0-9A-Z_a-z]', {value: '\\W'}],
['[^0-9_a-zA-Z]', {value: '\\W'}],
['[^0-9_A-Za-z]', {value: '\\W'}],
['[^_a-zA-Z0-9]', {value: '\\W'}],
['[^_a-z0-9A-Z]', {value: '\\W'}],
['[^_A-Za-z0-9]', {value: '\\W'}],
['[^_A-Z0-9a-z]', {value: '\\W'}],
['[^_0-9a-zA-Z]', {value: '\\W'}],
['[^_0-9A-Za-z]', {value: '\\W'}],
// Non-word with digit
['[^a-zA-Z\\d_]', {value: '\\W'}],
['[^a-zA-Z_\\d]', {value: '\\W'}],
['[^a-z\\dA-Z_]', {value: '\\W'}],
['[^a-z\\d_A-Z]', {value: '\\W'}],
['[^a-z_A-Z\\d]', {value: '\\W'}],
['[^a-z_\\dA-Z]', {value: '\\W'}],
['[^A-Za-z\\d_]', {value: '\\W'}],
['[^A-Za-z_\\d]', {value: '\\W'}],
['[^A-Z\\da-z_]', {value: '\\W'}],
['[^A-Z\\d_a-z]', {value: '\\W'}],
['[^A-Z_a-z\\d]', {value: '\\W'}],
['[^A-Z_\\da-z]', {value: '\\W'}],
['[^\\da-zA-Z_]', {value: '\\W'}],
['[^\\da-z_A-Z]', {value: '\\W'}],
['[^\\dA-Za-z_]', {value: '\\W'}],
['[^\\dA-Z_a-z]', {value: '\\W'}],
['[^\\d_a-zA-Z]', {value: '\\W'}],
['[^\\d_A-Za-z]', {value: '\\W'}],
['[^_a-zA-Z\\d]', {value: '\\W'}],
['[^_a-z\\dA-Z]', {value: '\\W'}],
['[^_A-Za-z\\d]', {value: '\\W'}],
['[^_A-Z\\da-z]', {value: '\\W'}],
['[^_\\da-zA-Z]', {value: '\\W'}],
['[^_\\dA-Za-z]', {value: '\\W'}],
// Word with case insensitivity
['[a-z0-9_]', {value: '\\w', flags: 'i'}],
['[a-z_0-9]', {value: '\\w', flags: 'i'}],
['[0-9a-z_]', {value: '\\w', flags: 'i'}],
['[0-9_a-z]', {value: '\\w', flags: 'i'}],
['[_a-z0-9]', {value: '\\w', flags: 'i'}],
['[_0-9a-z]', {value: '\\w', flags: 'i'}],
['[^a-z0-9_]', {value: '\\W', flags: 'i'}],
// Word with case insensitivity and digit
['[a-z\\d_]', {value: '\\w', flags: 'i'}],
['[a-z_\\d]', {value: '\\w', flags: 'i'}],
['[\\da-z_]', {value: '\\w', flags: 'i'}],
['[\\d_a-z]', {value: '\\w', flags: 'i'}],
['[_a-z\\d]', {value: '\\w', flags: 'i'}],
['[_\\da-z]', {value: '\\w', flags: 'i'}],
// Non-word with case insensitivity
['[^a-z0-9_]', {value: '\\W', flags: 'i'}],
['[^a-z_0-9]', {value: '\\W', flags: 'i'}],
['[^0-9a-z_]', {value: '\\W', flags: 'i'}],
['[^0-9_a-z]', {value: '\\W', flags: 'i'}],
['[^_a-z0-9]', {value: '\\W', flags: 'i'}],
['[^_0-9a-z]', {value: '\\W', flags: 'i'}],
// Non-word with case insensitivity and digit
['[^a-z\\d_]', {value: '\\W', flags: 'i'}],
['[^a-z_\\d]', {value: '\\W', flags: 'i'}],
['[^\\da-z_]', {value: '\\W', flags: 'i'}],
['[^\\d_a-z]', {value: '\\W', flags: 'i'}],
['[^_a-z\\d]', {value: '\\W', flags: 'i'}],
['[^_\\da-z]', {value: '\\W', flags: 'i'}]
]);
+9
View File
@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sam Verschueren <sam.verschueren@gmail.com> (github.com/SamVerschueren)
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.
@@ -0,0 +1,11 @@
'use strict';
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
module.exports = function (str) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
return str.replace(matchOperatorsRe, '\\$&');
};
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
@@ -0,0 +1,41 @@
{
"name": "escape-string-regexp",
"version": "1.0.5",
"description": "Escape RegExp special characters",
"license": "MIT",
"repository": "sindresorhus/escape-string-regexp",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"maintainers": [
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
"Joshua Boy Nicolai Appelman <joshua@jbna.nl> (jbna.nl)"
],
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"escape",
"regex",
"regexp",
"re",
"regular",
"expression",
"string",
"str",
"special",
"characters"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
}
@@ -0,0 +1,27 @@
# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp)
> Escape RegExp special characters
## Install
```
$ npm install --save escape-string-regexp
```
## Usage
```js
const escapeStringRegexp = require('escape-string-regexp');
const escapedString = escapeStringRegexp('how much $ for a unicorn?');
//=> 'how much \$ for a unicorn\?'
new RegExp(escapedString);
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
+39
View File
@@ -0,0 +1,39 @@
{
"name": "clean-regexp",
"version": "1.0.0",
"description": "Clean up regular expressions",
"license": "MIT",
"repository": "SamVerschueren/clean-regexp",
"author": {
"name": "Sam Verschueren",
"email": "sam.verschueren@gmail.com",
"url": "github.com/SamVerschueren"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js",
"lib"
],
"keywords": [
"regex",
"regexp",
"regular",
"expression",
"clean",
"cleanup",
"digit",
"word"
],
"dependencies": {
"escape-string-regexp": "^1.0.5"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
}
+67
View File
@@ -0,0 +1,67 @@
# clean-regexp [![Build Status](https://travis-ci.org/SamVerschueren/clean-regexp.svg?branch=master)](https://travis-ci.org/SamVerschueren/clean-regexp)
> Clean up regular expressions
## Install
```
$ npm install clean-regexp
```
## Usage
```js
const cleanRegexp = require('clean-regexp');
cleanRegexp('[0-9]');
//=> '\\d'
cleanRegexp('[^0-9]');
//=> '\\D'
cleanRegexp('[a-zA-Z0-9_]');
//=> '\\w'
cleanRegexp('[a-z0-9_]', 'i');
//=> '\\w'
cleanRegexp('[^a-zA-Z0-9_]');
//=> '\\W'
cleanRegexp('[^a-z0-9_]', 'i');
//=> '\\W'
cleanRegexp('[a-zA-Z\\d_]');
//=> '\\w'
cleanRegexp('[^a-zA-Z\\d_]');
//=> '\\W'
cleanRegexp('[0-9]+\\.[a-zA-Z0-9_]?');
//=> '\\d+\\.\\w'
```
## API
### cleanRegexp(regexp, [flags])
#### regexp
Type: `string`
Text of the regular expression.
#### flags
Type: `string`<br>
Default: `''`
Flags of the regular expression.
## License
MIT © [Sam Verschueren](https://github.com/SamVerschueren)