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

Function cleanArray

src/utils.ts:164–174  ·  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

162 * @returns The cleaned version of the array
163 */
164function cleanArray<T>(array: T[]): Array<T | null> {
165 for (let index = 0; index < array.length; index++) {
166 const isPropertyExist = objectHasOwnProperty(array, index);
167
168 if (!isPropertyExist) {
169 array[index] = null;
170 }
171 }
172
173 return array;
174}
175
176/**
177 * Shallow clone an object

Callers 1

cloneFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected