@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 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
@@ -44,5 +44,4 @@ function equal(a, b) {
44
44
  }
45
45
  return a === b;
46
46
  }
47
- var _default = equal;
48
- exports["default"] = _default;
47
+ var _default = exports["default"] = equal;
package/is.js CHANGED
@@ -319,5 +319,4 @@ var Is = Object.freeze(Object.defineProperties(Object.create(null), {
319
319
  value: _equal["default"]
320
320
  }
321
321
  }));
322
- var _default = Is;
323
- exports["default"] = _default;
322
+ var _default = exports["default"] = Is;
package/object/merge.js CHANGED
@@ -20,5 +20,4 @@ var merge = function merge() {
20
20
  return acc;
21
21
  }, {});
22
22
  };
23
- var _default = merge;
24
- exports["default"] = _default;
23
+ var _default = exports["default"] = merge;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valkyriestudios/utils",
3
- "version": "7.3.0",
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.22.5",
36
- "@babel/core": "^7.22.5",
37
- "@babel/preset-env": "^7.22.5",
38
- "@babel/register": "^7.22.5",
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.7",
44
+ "chai": "^4.3.10",
45
45
  "chai-as-promised": "^7.1.1",
46
46
  "chai-spies": "^1.0.0",
47
- "eslint": "^8.43.0",
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
+ }