Skip to content

Commit

Permalink
Fix: [MIQ-2130] Issues with publisher when value is 0 (#268)
Browse files Browse the repository at this point in the history
* Fix issues with publisher

* Add error handling to function

* Modify error handling logic
  • Loading branch information
shmsr authored and Arpit committed Nov 21, 2019
1 parent 943b4de commit 0c27fce
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,22 @@ const getFilter = (col, op, val) => {
}
}

const valueToString = (value) => value ? value.toString() : value;
const valueToStringErr = (value) => {
console.log("Error: [Prototype-less object] parameter encountered for getEffectiveExtraFilters");
return "Error: [Prototype-less object] as parameter encountered";
}

const valueToString = (value) => {
return value == null ? '' : (typeof value === 'object' && !value.toString ? valueToStringErr(value) : String(value));
}

/*
Ref: https://stackoverflow.com/a/53796206/5821408
const valueToString = (value) => value ? value.toString() : value;
valueToString(0) // Output = 0 (Problem with 0 due to JS's way to handle 0 (NAN, '', etc.))
valueToString(1) // Output = "1"
valueToString(2) // Output = "2"
*/

export function getEffectiveExtraFilters({
dashboardMetadata,
Expand Down

0 comments on commit 0c27fce

Please sign in to comment.