MCPcopy Index your code
hub / github.com/chartbrew/chartbrew / normalizeValue

Function normalizeValue

server/modules/chartRuntimeFilters.js:30–53  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

28}
29
30function normalizeValue(value) {
31 if (value === undefined || value === null) return value;
32
33 if (momentObj.isMoment(value)) {
34 return value.toISOString();
35 }
36
37 if (value instanceof Date) {
38 return value.toISOString();
39 }
40
41 if (Array.isArray(value)) {
42 return value.map(normalizeValue);
43 }
44
45 if (typeof value === "object") {
46 return Object.keys(value).sort().reduce((acc, key) => {
47 acc[key] = normalizeValue(value[key]);
48 return acc;
49 }, {});
50 }
51
52 return value;
53}
54
55function normalizeVariables(variables = {}) {
56 return Object.entries(variables || {}).reduce((acc, [key, value]) => {

Callers 4

hashMethod · 0.70
normalizeVariablesFunction · 0.70
normalizeFilterFunction · 0.70
getFilterKeyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected