@sera4/essentia 1.1.30 → 1.1.32

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sera4/essentia",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
4
4
  "description": "A library of utilities for Teleporte Web Services",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/package.tar.gz CHANGED
Binary file
@@ -70,6 +70,7 @@ export class Subscriber {
70
70
  } catch (e) {
71
71
  logger.error("Failed to parse incomming message:", e);
72
72
  error = e;
73
+ payload = { error, original_content: content.toString() };
73
74
  }
74
75
  payload.metadata = fields;
75
76
  logger.debug(`Got message from exchange '${fields.exchange}' with key '${fields.routingKey}'`);
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
  }