biz-slide-core 1.2.18 → 1.2.20
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/entity/index.js +1 -0
- package/entity/logs.entity.js +12 -0
- package/entity/png-svg.entity.js +1 -0
- package/package.json +1 -1
- package/utilities/hasAbusiveWords.js +19 -2
package/entity/index.js
CHANGED
@@ -27,3 +27,4 @@ __exportStar(require("./template-type.entity"), exports);
|
|
27
27
|
__exportStar(require("./user.entity"), exports);
|
28
28
|
__exportStar(require("./training-queue.entity"), exports);
|
29
29
|
__exportStar(require("./config.enity"), exports);
|
30
|
+
__exportStar(require("./logs.entity"), exports);
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.LogsModel = void 0;
|
4
|
+
var mongoose_1 = require("mongoose");
|
5
|
+
var LogsSchema = new mongoose_1.Schema({
|
6
|
+
type: { type: String, required: true },
|
7
|
+
event: { type: String, required: true },
|
8
|
+
message: { type: String, required: true },
|
9
|
+
}, {
|
10
|
+
timestamps: true,
|
11
|
+
});
|
12
|
+
exports.LogsModel = (0, mongoose_1.model)("logs", LogsSchema);
|
package/entity/png-svg.entity.js
CHANGED
@@ -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,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
|
27
|
+
if (hasExactMatch(lowerStr, word.toLowerCase())) {
|
11
28
|
return true;
|
12
29
|
}
|
13
30
|
}
|