We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a9cda51 commit ed1a80dCopy full SHA for ed1a80d
src/js/utils.js
@@ -0,0 +1,10 @@
1
+/**
2
+ * Rounds a number to the nearest 0.5 increment.
3
+ * This reduces URL variations for DPR values.
4
+ *
5
+ * @param {number} value - The value to round.
6
+ * @return {number} The rounded value (e.g., 1.666 -> 1.5, 2.3 -> 2.5).
7
+ */
8
+export const roundToHalf = ( value ) => {
9
+ return Math.round( value * 2 ) / 2;
10
+};
0 commit comments