* Clean up an array to harden against CSPP * * @param array - The array to be cleaned. * @returns The cleaned version of the array
(array: T[])
| 157 | * @returns The cleaned version of the array |
| 158 | */ |
| 159 | function cleanArray<T>(array: T[]): Array<T | null> { |
| 160 | for (let index = 0; index < array.length; index++) { |
| 161 | const isPropertyExist = objectHasOwnProperty(array, index); |
| 162 | |
| 163 | if (!isPropertyExist) { |
| 164 | array[index] = null; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | return array; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Shallow clone an object |