(value)
| 28 | } |
| 29 | |
| 30 | function 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 | |
| 55 | function normalizeVariables(variables = {}) { |
| 56 | return Object.entries(variables || {}).reduce((acc, [key, value]) => { |
no outgoing calls
no test coverage detected