@ptolemy2002/regex-utils 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/index.js +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,8 +171,7 @@ Attempts to check if a string is a valid Social Security Number (SSN). Note that
|
|
|
171
171
|
`Boolean` - `true` if the string is a valid SSN, `false` otherwise.
|
|
172
172
|
|
|
173
173
|
## Meta
|
|
174
|
-
This is a React Library Created by Ptolemy2002's [cra-template-react-library](https://www.npmjs.com/package/@ptolemy2002/cra-template-react-library) template in combination with [create-react-app](https://www.npmjs.com/package/create-react-app). It contains methods of building and publishing your library to npm.
|
|
175
|
-
For now, the library makes use of React 18 and does not use TypeScript.
|
|
174
|
+
This is a React Library Created by Ptolemy2002's [cra-template-react-library](https://www.npmjs.com/package/@ptolemy2002/cra-template-react-library) template in combination with [create-react-app](https://www.npmjs.com/package/create-react-app). However, it does not actually depend on React - it has been modified to work out of the box. It contains methods of building and publishing your library to npm.
|
|
176
175
|
|
|
177
176
|
## Peer Dependencies
|
|
178
177
|
This project does not have any peer dependencies, so it should work out of the box.
|
package/index.js
CHANGED
|
@@ -117,8 +117,11 @@ function transformRegex(value, { flags = "", accentInsensitive = false, caseInse
|
|
|
117
117
|
if (accentInsensitive) value = regexAccentInsensitive(value, flags);
|
|
118
118
|
if (caseInsensitive) value = regexCaseInsensitive(value, flags);
|
|
119
119
|
if (matchWhole) value = regexMatchWhole(value, flags);
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
if (value instanceof RegExp) {
|
|
121
|
+
value = new RegExp(value.source, combineFlags(value.flags, flags));
|
|
122
|
+
} else {
|
|
123
|
+
value = new RegExp(value, flags);
|
|
124
|
+
}
|
|
122
125
|
return value;
|
|
123
126
|
}
|
|
124
127
|
function isValidRegex(value, flags = "") {
|