UNPKG

@heycar-uikit/core

Version:
19 lines (16 loc) 593 B
import { MAX_SCORE, ARROW_DIFF_DEG, MAX_CIRCLE_POINT } from '../constants/ReviewRating.constants.js'; var getParsedScore = function (score) { var parsedScore = !score || isNaN(score) ? 0 : Math.round(score); if (parsedScore < 0) parsedScore = 0; if (parsedScore > MAX_SCORE) parsedScore = MAX_SCORE; return parsedScore; }; var getPositionData = function (score) { return { arrowRotation: (score / MAX_SCORE) * ARROW_DIFF_DEG, donutStrokeLength: (score / MAX_SCORE) * MAX_CIRCLE_POINT, }; }; export { getParsedScore, getPositionData };