(value)
| 45 | } |
| 46 | } |
| 47 | |
| 48 | function pruneCliPayload(value) { |
| 49 | if (Array.isArray(value)) { |
| 50 | return value |
| 51 | .map(item => pruneCliPayload(item)) |
| 52 | .filter(item => item !== undefined) |
| 53 | } |
| 54 | |
| 55 | if (value && typeof value === 'object') { |
| 56 | const nextObject = {} |
| 57 | |
| 58 | for (const [key, item] of Object.entries(value)) { |
| 59 | if (CLI_UNSUPPORTED_FIELDS.has(key)) { |
| 60 | continue |
| 61 | } |
| 62 | |
| 63 | const nextValue = pruneCliPayload(item) |
| 64 | if (nextValue === undefined) { |
| 65 | continue |
| 66 | } |
| 67 | |
| 68 | if (Array.isArray(nextValue) && nextValue.length === 0 && key !== 'messages') { |
| 69 | continue |
| 70 | } |
| 71 | |
| 72 | if ( |
| 73 | nextValue && |
| 74 | typeof nextValue === 'object' && |
| 75 | !Array.isArray(nextValue) && |
| 76 | Object.keys(nextValue).length === 0 |
| 77 | ) { |
| 78 | continue |
| 79 | } |
| 80 | |
| 81 | nextObject[key] = nextValue |
| 82 | } |
| 83 | |
| 84 | return nextObject |
| 85 | } |
| 86 | |
| 87 | if (value === null || value === undefined) { |
| 88 | return undefined |
| 89 | } |
| 90 | |
| 91 | return value |
| 92 | } |
| 93 | |
| 94 | function isInjectedSystemPart(part) { |
no outgoing calls
no test coverage detected