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

Function cleanArray

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

136 * @returns The cleaned version of the array
137 */
138function 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

Callers 1

cloneFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected