victory-native
Version:
[](https://commerce.nearform.com/open-source/victory-native/)
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][],
);