Module

truncate

Caps an arbitrary JS value down to something safe to log or hand back to a caller — long strings get an ellipsis, long arrays keep only their first items (with a note of how many were dropped), and anything that isn't plain JSON-shaped (BigInt, an Error, a circular reference) is coerced to a readable string instead of throwing.

Unlike a flat string truncation (e.g. this file's own truncateDebug in ScenidCloudService.class.js), the result stays a real object/array — safe for a caller to read .length or a field off of, not just print.

Used by InsightsService's dry-run write mocks (see InsightsService.class.js's _guardWrite) so a script that tries to mock-insert a huge batch doesn't get the whole batch echoed back.

View Source truncate.js, line 1