The AnyValue to extract from
The extracted JavaScript value
// Extract primitive values
const stringVal = extractAnyValue({ stringValue: "hello" });
// Result: "hello"
const numberVal = extractAnyValue({ intValue: 42 });
// Result: 42
const boolVal = extractAnyValue({ boolValue: true });
// Result: true
// Extract arrays
const arrayVal = extractAnyValue({
arrayValue: {
values: [
{ stringValue: "item1" },
{ intValue: 42 }
]
}
});
// Result: ["item1", 42]
// Extract objects
const objectVal = extractAnyValue({
kvlistValue: {
values: [
{ key: "name", value: { stringValue: "turtle" } },
{ key: "level", value: { intValue: 64 } }
]
}
});
// Result: { name: "turtle", level: 64 }
🔍 Extract a JavaScript value from an AnyValue.
Converts OpenTelemetry AnyValue back to regular JavaScript values. This is useful when you need to work with attribute values in their original JavaScript form.