* Clean up an array to harden against CSPP * * @param array - The array to be cleaned. * @returns The cleaned version of the array
(array: T[])
| 136 | * @returns The cleaned version of the array |
| 137 | */ |
| 138 | function cleanArray<T>(array: T[]): Array<T | null> { |
| 139 | for (let index = 0; index < array.length; index++) { |
| 140 | const isPropertyExist = objectHasOwnProperty(array, index); |
| 141 | |
| 142 | if (!isPropertyExist) { |
| 143 | array[index] = null; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | return array; |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * Shallow clone an object |