UNPKG

subcollection

Version:

A collection of scripts to send Core Web Vital data to GA4

31 lines (25 loc) 652 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLCPRating = getLCPRating; var _getConstants = require("./getConstants"); /** * getLCPRating * Determines whether a LCP score is good, average, or poor. * * @param {number} value value of the LCP metric * @returns {string} the string value rating */ function getLCPRating(value) { if (value < 0 || typeof value !== 'number') { return _getConstants.NO_RATING; } if (value <= 2500) { return _getConstants.GOOD_SCORE; } if (value > 2500 && value < 4000) { return _getConstants.AVERAGE_SCORE; } return _getConstants.POOR_SCORE; }