@valkyriestudios/utils 7.3.0 → 7.4.0
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/CHANGELOG.md +10 -0
- package/README.md +6 -0
- package/package.json +5 -5
- package/regexp/sanitize.js +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic
|
|
6
6
|
Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [7.4.0] - 2023-08-10
|
|
9
|
+
### Added
|
|
10
|
+
- regexp/sanitize
|
|
11
|
+
|
|
12
|
+
### Improved
|
|
13
|
+
- Dep: Upgrade @babel/cli to 7.22.10
|
|
14
|
+
- Dep: Upgrade @babel/core to 7.22.10
|
|
15
|
+
- Dep: Upgrade @babel/preset-env to 7.22.10
|
|
16
|
+
- Dep: Upgrade eslint to 8.46.0
|
|
17
|
+
|
|
8
18
|
## [7.3.0] - 2023-06-25
|
|
9
19
|
### Added
|
|
10
20
|
- data/continents.json
|
package/README.md
CHANGED
|
@@ -768,6 +768,12 @@ isRegExp(new RegExp(/ab+c/, 'i')); // TRUE
|
|
|
768
768
|
isRegExp(/ab+c/i); // FALSE
|
|
769
769
|
```
|
|
770
770
|
|
|
771
|
+
- **sanitize(val:string)**
|
|
772
|
+
Escapes special characters in a string and returns a sanitized version safe for usage in RegExp instances
|
|
773
|
+
```js
|
|
774
|
+
sanitizeRegExp('contact@valkyriestudios.be'); // contact@valkyriestudios\\.be
|
|
775
|
+
```
|
|
776
|
+
|
|
771
777
|
### string
|
|
772
778
|
- **isString(val:any)**
|
|
773
779
|
Check if a variable is a string
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valkyriestudios/utils",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "A collection of single-function utilities for common tasks",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/ValkyrieStudios/utils#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@babel/cli": "^7.22.
|
|
36
|
-
"@babel/core": "^7.22.
|
|
37
|
-
"@babel/preset-env": "^7.22.
|
|
35
|
+
"@babel/cli": "^7.22.10",
|
|
36
|
+
"@babel/core": "^7.22.10",
|
|
37
|
+
"@babel/preset-env": "^7.22.10",
|
|
38
38
|
"@babel/register": "^7.22.5",
|
|
39
39
|
"babel-plugin-check-es2015-constants": "^6.22.0",
|
|
40
40
|
"babel-plugin-transform-member-expression-literals": "^6.9.4",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"chai": "^4.3.7",
|
|
45
45
|
"chai-as-promised": "^7.1.1",
|
|
46
46
|
"chai-spies": "^1.0.0",
|
|
47
|
-
"eslint": "^8.
|
|
47
|
+
"eslint": "^8.46.0",
|
|
48
48
|
"mocha": "^10.2.0",
|
|
49
49
|
"nyc": "^15.1.0"
|
|
50
50
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = sanitizeRegExp;
|
|
7
|
+
var _isNotEmpty = _interopRequireDefault(require("../string/isNotEmpty"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
function sanitizeRegExp(val) {
|
|
10
|
+
if (!(0, _isNotEmpty["default"])(val)) return !1;
|
|
11
|
+
return val.trim().replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&');
|
|
12
|
+
}
|