@stbmoz-onboarding/core 1.0.27 → 1.0.28
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/Functions/functions.js +26 -4
- package/Functions/index.js +4 -2
- package/package.json +1 -1
package/Functions/functions.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
const { isAboveMaxLength, isMinLength, notIncludes, isIn } = require("./../Validations")
|
|
2
2
|
|
|
3
3
|
const feedbacks = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
oversized: "Ultrapassou o limite de caracteres",
|
|
5
|
+
invalidChars: "O campo contem caracteres inválidos",
|
|
6
|
+
required: "Campo obrigatório"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
module.exports.removeFile = (path) => {
|
|
10
|
+
try {
|
|
11
|
+
if (!path) {
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
fs.unlink(path, (err) => {
|
|
15
|
+
if (err) console.error(err)
|
|
16
|
+
})
|
|
17
|
+
} catch (error) { }
|
|
18
|
+
}
|
|
8
19
|
|
|
9
20
|
module.exports.GenerateNumericPin = async (pinSize) => {
|
|
10
21
|
let pin = ''
|
|
@@ -87,4 +98,15 @@ module.exports.Serializer = (requestBody, allowedFieldsArray) => {
|
|
|
87
98
|
})
|
|
88
99
|
|
|
89
100
|
return requestBody
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
module.exports.SubArrayGenerator = (arrayOfObjects, key) => {
|
|
105
|
+
let subArray = []
|
|
106
|
+
|
|
107
|
+
arrayOfObjects.forEach(item=>{
|
|
108
|
+
subArray.push(item[key])
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
return subArray
|
|
90
112
|
}
|
package/Functions/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
const {
|
|
2
|
-
AllowedPrefixes, GenerateNumericPin, ReferenceGenerator, Sanitize, Serializer
|
|
2
|
+
AllowedPrefixes, GenerateNumericPin, ReferenceGenerator, Sanitize, Serializer,
|
|
3
|
+
removeFile, SubArrayGenerator
|
|
3
4
|
} = require("./functions")
|
|
4
5
|
|
|
5
6
|
module.exports = {
|
|
6
|
-
AllowedPrefixes, GenerateNumericPin, ReferenceGenerator, Sanitize, Serializer
|
|
7
|
+
AllowedPrefixes, GenerateNumericPin, ReferenceGenerator, Sanitize, Serializer, removeFile,
|
|
8
|
+
SubArrayGenerator
|
|
7
9
|
}
|