( attributes: RawAttributes<T> | undefined, fallback: boolean | 'skip-undefined' = false, )
| 113 | * @returns The serialized attributes. |
| 114 | */ |
| 115 | export function serializeAttributes<T>( |
| 116 | attributes: RawAttributes<T> | undefined, |
| 117 | fallback: boolean | 'skip-undefined' = false, |
| 118 | ): Attributes { |
| 119 | const serializedAttributes: Attributes = {}; |
| 120 | for (const [key, value] of Object.entries(attributes ?? {})) { |
| 121 | const typedValue = attributeValueToTypedAttributeValue(value, fallback); |
| 122 | if (typedValue) { |
| 123 | serializedAttributes[key] = typedValue; |
| 124 | } |
| 125 | } |
| 126 | return serializedAttributes; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Estimates the serialized byte size of {@link Attributes}, |
no test coverage detected