@tanstack/charts
Version:
<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/api/readme/charts.png?theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/
19 lines (18 loc) • 503 B
JavaScript
const childrenByOptions = /* @__PURE__ */ new WeakMap();
function svgRenderChildren(options) {
return childrenByOptions.get(options);
}
function withSvgRenderChildren(options, children, render) {
const previous = childrenByOptions.get(options);
childrenByOptions.set(options, children);
try {
return render();
} finally {
if (previous) childrenByOptions.set(options, previous);
else childrenByOptions.delete(options);
}
}
export {
svgRenderChildren,
withSvgRenderChildren
};