Skip to content

procxy / sanitizeForV8Array

Function: sanitizeForV8Array()

ts
function sanitizeForV8Array(values, seen?): any[];

Defined in: src/shared/serialization.ts:429

Apply sanitizeForV8 to each element of an array, returning a new sanitized array.

Parameters

ParameterTypeDescription
valuesunknown[]Array of values to sanitize; each element is processed independently
seenWeakSet<object>Internal WeakSet for circular-reference tracking; callers should omit this

Returns

any[]

New array where each element has had non-V8-serializable properties stripped

Remarks

Shares a single WeakSet circular-reference guard across all elements, so cross-element circular references are also caught. Used internally by procxy() when sanitizeV8: true is set in ProcxyOptions and constructor-argument validation fails.

Example

typescript
import { sanitizeForV8Array } from 'procxy';

const args = [
  { config: true, handler: () => {} },
  { value: 42 }
];
const sanitized = sanitizeForV8Array(args);
// Result: [{ config: true }, { value: 42 }]

See

sanitizeForV8 — single-value variant

Released under the MIT License.