UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

24 lines (18 loc) 475 B
'use strict'; /*! * @techmely/utils * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com> * MIT Licensed */ // src/isArray.ts function isArray(val) { return val && Array.isArray(val); } // src/toPointsArray.ts function toPointsArray(points) { if (isArray(points[0])) { return points.map(([x, y, pressure = 0.5]) => [x, y, pressure]); } return points.map(({ x, y, pressure = 0.5 }) => [x, y, pressure]); } exports.toPointsArray = toPointsArray;