@valkyriestudios/utils 7.3.0 → 7.5.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 +20 -0
- package/README.md +7 -1
- package/date/addUTC.js +6 -0
- package/equal.js +1 -2
- package/is.js +1 -2
- package/object/merge.js +1 -2
- package/package.json +7 -7
- package/regexp/sanitize.js +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ 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.5.0] - 2023-10-22
|
|
9
|
+
### Improved
|
|
10
|
+
- Dep: Upgrade @babel/cli to 7.23.0
|
|
11
|
+
- Dep: Upgrade @babel/core to 7.23.2
|
|
12
|
+
- Dep: Upgrade @babel/preset-env to 7.23.2
|
|
13
|
+
- Dep: Upgrade @babel/register to 7.22.15
|
|
14
|
+
- Dep: Upgrade chai to 4.3.10
|
|
15
|
+
- Dep: Upgrade eslint to 8.52.0
|
|
16
|
+
- date/addUTC now supports millisecond/milliseconds as keys
|
|
17
|
+
|
|
18
|
+
## [7.4.0] - 2023-08-10
|
|
19
|
+
### Added
|
|
20
|
+
- regexp/sanitize
|
|
21
|
+
|
|
22
|
+
### Improved
|
|
23
|
+
- Dep: Upgrade @babel/cli to 7.22.10
|
|
24
|
+
- Dep: Upgrade @babel/core to 7.22.10
|
|
25
|
+
- Dep: Upgrade @babel/preset-env to 7.22.10
|
|
26
|
+
- Dep: Upgrade eslint to 8.46.0
|
|
27
|
+
|
|
8
28
|
## [7.3.0] - 2023-06-25
|
|
9
29
|
### Added
|
|
10
30
|
- data/continents.json
|
package/README.md
CHANGED
|
@@ -349,7 +349,7 @@ endOfUTC(new Date("2023-05-04T12:04:27.043+02:00"), 'second'); // new Date("2023
|
|
|
349
349
|
```
|
|
350
350
|
|
|
351
351
|
- **addUTC(val:Date, amount:integer, key:String)**
|
|
352
|
-
Take the incoming date and add a certain amount of the passed key. Possible key options(year,years,month,months,day,days,hour,hours,minute,minutes,second,seconds).
|
|
352
|
+
Take the incoming date and add a certain amount of the passed key. Possible key options(year,years,month,months,day,days,hour,hours,minute,minutes,second,seconds,millisecond,milliseconds).
|
|
353
353
|
|
|
354
354
|
Note: Does not touch the date object passed
|
|
355
355
|
```js
|
|
@@ -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/date/addUTC.js
CHANGED
|
@@ -50,6 +50,12 @@ function addUTC(val, amount, key) {
|
|
|
50
50
|
copy.setUTCSeconds(copy.getUTCSeconds() + amount);
|
|
51
51
|
return copy;
|
|
52
52
|
}
|
|
53
|
+
case 'milliseconds':
|
|
54
|
+
case 'millisecond':
|
|
55
|
+
{
|
|
56
|
+
copy.setUTCMilliseconds(copy.getUTCMilliseconds() + amount);
|
|
57
|
+
return copy;
|
|
58
|
+
}
|
|
53
59
|
default:
|
|
54
60
|
return copy;
|
|
55
61
|
}
|
package/equal.js
CHANGED
package/is.js
CHANGED
package/object/merge.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valkyriestudios/utils",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0",
|
|
4
4
|
"description": "A collection of single-function utilities for common tasks",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -32,19 +32,19 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/ValkyrieStudios/utils#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@babel/cli": "^7.
|
|
36
|
-
"@babel/core": "^7.
|
|
37
|
-
"@babel/preset-env": "^7.
|
|
38
|
-
"@babel/register": "^7.22.
|
|
35
|
+
"@babel/cli": "^7.23.0",
|
|
36
|
+
"@babel/core": "^7.23.2",
|
|
37
|
+
"@babel/preset-env": "^7.23.2",
|
|
38
|
+
"@babel/register": "^7.22.15",
|
|
39
39
|
"babel-plugin-check-es2015-constants": "^6.22.0",
|
|
40
40
|
"babel-plugin-transform-member-expression-literals": "^6.9.4",
|
|
41
41
|
"babel-plugin-transform-minify-booleans": "^6.9.4",
|
|
42
42
|
"babel-plugin-transform-property-literals": "^6.9.4",
|
|
43
43
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
44
|
-
"chai": "^4.3.
|
|
44
|
+
"chai": "^4.3.10",
|
|
45
45
|
"chai-as-promised": "^7.1.1",
|
|
46
46
|
"chai-spies": "^1.0.0",
|
|
47
|
-
"eslint": "^8.
|
|
47
|
+
"eslint": "^8.52.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
|
+
}
|