MCPcopy Create free account
hub / github.com/chartbrew/chartbrew / getValue

Function getValue

server/charts/dataFilter.js:21–39  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

19
20 // extract value
21 const getValue = (obj) => {
22 const selectors = field.split(".");
23 let value = obj;
24 for (let i = 0; i < selectors.length; i++) {
25 value = value && value[selectors[i]];
26 }
27
28 if (!value) return null;
29
30 // check for a potential timestamp format
31 if (parseInt(value, 10).toString() === value.toString() && value.toString().length === 10) {
32 return moment(value, "X");
33 }
34 if (parseInt(value, 10).toString() === value.toString() && value.toString().length === 13) {
35 return moment(value, "x");
36 }
37
38 return momentObj.utc(value);
39 };
40
41 switch (condition.operator) {
42 case "is":

Callers 4

compareDatesFunction · 0.85
compareNumbersFunction · 0.85
compareStringsFunction · 0.85
compareBooleansFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected