mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
15 lines
364 B
Plaintext
15 lines
364 B
Plaintext
const customStringify = function (v) {
|
|
const cache = new Set();
|
|
return JSON.stringify(v, function (key, value) {
|
|
if (typeof value === 'object' && value !== null) {
|
|
if (cache.has(value)) {
|
|
// Circular reference found, discard key
|
|
return;
|
|
}
|
|
// Store value in our set
|
|
cache.add(value);
|
|
}
|
|
return value;
|
|
});
|
|
};
|