MCPcopy Create free account
hub / github.com/cure53/DOMPurify / cleanArray

Function cleanArray

src/utils.ts:159–169  ·  view source on GitHub ↗

* Clean up an array to harden against CSPP * * @param array - The array to be cleaned. * @returns The cleaned version of the array

(array: T[])

Source from the content-addressed store, hash-verified

157 * @returns The cleaned version of the array
158 */
159function 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

Callers 1

cloneFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected