@ejfdelgado/ejflab-back 1.30.1 → 1.30.3

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": "@ejfdelgado/ejflab-back",
3
- "version": "1.30.1",
3
+ "version": "1.30.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ejfdelgado/ejflab-back.git"
@@ -39,9 +39,15 @@ export class PostgresSrv {
39
39
  });
40
40
  }
41
41
  static noQuotes(val, ...args) {
42
+ if ([null, undefined].indexOf(val) >= 0) {
43
+ return "NULL";
44
+ }
42
45
  return val.replace(/'/g, "''");
43
46
  }
44
47
  static singleWord(val, ...args) {
48
+ if ([null, undefined].indexOf(val) >= 0) {
49
+ return "NULL";
50
+ }
45
51
  return val.split(/\s+/g)[0];
46
52
  }
47
53
  static sanitizeText(val, ...args) {
@@ -1,5 +1,6 @@
1
1
  import md5 from 'md5';
2
2
  import { MalaPeticionException, ParametrosIncompletosException } from '../MyError.mjs';
3
+ import { SimpleObj } from "@ejfdelgado/ejflab-common/src/SimpleObj.js";
3
4
 
4
5
  export class General {
5
6
  static PAGE_SIZE_DEFAULT = "20";
@@ -23,8 +24,9 @@ export class General {
23
24
  }
24
25
  static readParam(req, name, pred = null, complain = false) {
25
26
  const nameLower = name.toLowerCase();
26
- if (req.body && name in req.body) {
27
- return req.body[name];
27
+ const first = SimpleObj.getValue(req.body, name, undefined);
28
+ if (first !== undefined) {
29
+ return first;
28
30
  } else if (req.query && name in req.query) {
29
31
  return req.query[name];
30
32
  } else if (req.query && nameLower in req.query) {