biz-slide-core 1.2.18 → 1.2.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,6 +8,7 @@ var PngSvgSchema = new mongoose_1.Schema({
8
8
  optionsDownloaded: mongoose_1.Schema.Types.Mixed,
9
9
  isDownloaded: { type: Boolean, default: false },
10
10
  isCompleted: { type: Boolean, default: false },
11
+ hasError: { type: Boolean, default: false },
11
12
  userId: { type: String, default: null },
12
13
  title: { type: String, default: null },
13
14
  styleCategory: { type: String, default: null },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz-slide-core",
3
- "version": "1.2.18",
3
+ "version": "1.2.19",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,13 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasAbusiveWords = void 0;
3
+ exports.hasAbusiveWords = exports.hasSpecialCharacter = exports.hasExactMatch = void 0;
4
+ function hasExactMatch(str, word) {
5
+ // Construct a regular expression to match the word as a whole word
6
+ var regex = new RegExp('\\b' + word + '\\b', 'i'); // 'i' for case-insensitive matching
7
+ // Test if the word has an exact match in the string
8
+ return regex.test(str);
9
+ }
10
+ exports.hasExactMatch = hasExactMatch;
11
+ function hasSpecialCharacter(str) {
12
+ // Define a regular expression with a character class containing special characters
13
+ var regex = /[!@#$%^&*()_+\-=\[\]{};:\\|<>\/?]/;
14
+ // Test if the string contains any special character
15
+ return regex.test(str);
16
+ }
17
+ exports.hasSpecialCharacter = hasSpecialCharacter;
4
18
  function hasAbusiveWords(str, words) {
5
19
  // Convert the string to lowercase for case-insensitive matching
6
20
  var lowerStr = str.toLowerCase();
21
+ if (hasSpecialCharacter(lowerStr)) {
22
+ return true;
23
+ }
7
24
  // Check if any abusive word exists in the string
8
25
  for (var _i = 0, words_1 = words; _i < words_1.length; _i++) {
9
26
  var word = words_1[_i];
10
- if (lowerStr.includes(word.toLowerCase())) {
27
+ if (hasExactMatch(lowerStr, word.toLowerCase())) {
11
28
  return true;
12
29
  }
13
30
  }