MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / removeInvalidSurrogates

Function removeInvalidSurrogates

packages/common/src/object.ts:21–25  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

19): Record<string, string> {
20 // Clickhouse breaks on insert if a property contains invalid surrogate pairs
21 function removeInvalidSurrogates(value: string): string {
22 const validSurrogatePairRegex =
23 /[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g;
24 return value.match(validSurrogatePairRegex)?.join('') || '';
25 }
26
27 return Object.entries(obj).reduce((acc, [key, value]) => {
28 if (typeof value === 'object' && value !== null) {

Callers 1

toDotsFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected