# filterCirculars

`function` in `utils` · v0.4.0

<https://docs.seedcord.org/packages/utils/0.4.0/functions/filter-circulars>

Creates a clean, JSON safe copy of a value and replaces circular references with a marker.

In `json` mode it behaves like stringify then parse with a replacer that handles cycles and BigInt. In `decycle` mode it first clones without using toJSON, then you can stringify the result later.

```ts
filterCirculars<ObjType, Marker>(
    value: ObjType,
    options?: FilterCircularsOptions<Marker>
): JsonifyWithCirculars<ObjType, Marker> | UnserializableValue
```

Creates a clean, JSON safe copy of a value and replaces circular references with a marker.

In `json` mode it behaves like stringify then parse with a replacer that handles cycles and BigInt. In `decycle` mode it first clones without using toJSON, then you can stringify the result later.

Parameters.

- `value` `ObjType` — The value to clone safely.
- `options?` `FilterCircularsOptions<Marker>` — Optional configuration.

Returns `JsonifyWithCirculars<ObjType, Marker> | UnserializableValue`.
