Your utils.js has a method called convertToPSParam which I believe is supposed to handle the passing of null to result in the return of null, allowing you, in turn, to specify null parameters values to indicate switches. However, it does not work. This code demonstrates this.
const getType = obj => Object.prototype.toString.call(obj).slice(8, -1);
const convertToPSParam = val => {
let x = getType(val);
console.log(x)
switch (x) {
case 'String':
return 1
case 'Number':
return 2
case 'Array':
return 3
case 'Object':
return 4
case 'Boolean':
return 5
case 'Date':
return 6
case 'Undefined' || 'Null':
return 7
default:
return 8
};
}
console.log(convertToPSParam(null))
I think it should be
const getType = obj => Object.prototype.toString.call(obj).slice(8, -1);
const convertToPSParam = val => {
let x = getType(val);
console.log(x)
switch (x) {
case 'String':
return 1
case 'Number':
return 2
case 'Array':
return 3
case 'Object':
return 4
case 'Boolean':
return 5
case 'Date':
return 6
case 'Undefined':
case 'Null':
return 7
default:
return 8
};
}
Your utils.js has a method called convertToPSParam which I believe is supposed to handle the passing of null to result in the return of null, allowing you, in turn, to specify null parameters values to indicate switches. However, it does not work. This code demonstrates this.
I think it should be
console.log(convertToPSParam(null))