@sera4/essentia 1.1.30 → 1.1.31
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/package.json +1 -1
- package/package.tar.gz +0 -0
- package/utils/index.js +5 -3
package/package.json
CHANGED
package/package.tar.gz
CHANGED
|
Binary file
|
package/utils/index.js
CHANGED
|
@@ -8,12 +8,14 @@ export const utils = {
|
|
|
8
8
|
return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(input);
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
|
-
// convert a regular string or Array to array (ie, "[1,2,3]", "1,2,3")
|
|
11
|
+
// convert a regular string or Array to array (ie, "[1,2,3, 0xA]", "1,2,3,10")
|
|
12
12
|
// useful for controller inputs
|
|
13
|
+
// - also accepts hex
|
|
13
14
|
convertToIntegerArray(input) {
|
|
14
15
|
return this.convertToArray(input)
|
|
15
16
|
.filter((el) => /^[0-9]+/.test(el))
|
|
16
|
-
.map((el) => parseInt(el))
|
|
17
|
+
.map((el) => parseInt(el))
|
|
18
|
+
.filter((el) => Number.isInteger(el));
|
|
17
19
|
},
|
|
18
20
|
convertToArray: (input) => {
|
|
19
21
|
if (Array.isArray(input)){
|
|
@@ -29,7 +31,7 @@ export const utils = {
|
|
|
29
31
|
}
|
|
30
32
|
input = input.replace(/[\[\]]/, '')
|
|
31
33
|
|
|
32
|
-
return input.split(',').filter((el) => /^[0-9A-Za-z-.]+/.test(el))
|
|
34
|
+
return input.replace(/\s+/, '').split(',').filter((el) => /^[0-9A-Za-z-.]+/.test(el));
|
|
33
35
|
} else {
|
|
34
36
|
return []
|
|
35
37
|
}
|