victory-native
Version:
A charting library for React Native with a focus on performance and customization.
14 lines (12 loc) • 355 B
text/typescript
import type { PointsArray } from "../types";
/**
* Stitches together PointsArray into an array of tuples for d3 consumption
*/
export const stitchDataArray = (data: PointsArray): [number, number][] =>
data.reduce(
(acc, { x, y }) => {
if (typeof y === "number") acc.push([x, y]);
return acc;
},
[] as [number, number][],
);