MCPcopy
hub / github.com/cure53/DOMPurify / cleanArray

Function cleanArray

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

151 * @returns The cleaned version of the array
152 */
153function cleanArray<T>(array: T[]): Array<T | null> {
154 for (let index = 0; index < array.length; index++) {
155 const isPropertyExist = objectHasOwnProperty(array, index);
156
157 if (!isPropertyExist) {
158 array[index] = null;
159 }
160 }
161
162 return array;
163}
164
165/**
166 * Shallow clone an object

Callers 1

cloneFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…