MCPcopy Create free account
hub / github.com/bernaferrari/FigmaToCode / exactValue

Function exactValue

packages/backend/src/tailwind/conversionTables.ts:29–42  ·  view source on GitHub ↗
(
  goal: number,
  array: Array<number>,
)

Source from the content-addressed store, hash-verified

27};
28
29export const exactValue = (
30 goal: number,
31 array: Array<number>,
32): number | null => {
33 for (let i = 0; i < array.length; i++) {
34 const diff = Math.abs(goal - array[i]);
35
36 if (diff <= 0.05) {
37 return array[i];
38 }
39 }
40
41 return null;
42};
43
44/**
45 * convert pixel values to Tailwind attributes.

Callers 3

tailwindRotationFunction · 0.90
pxToRemToTailwindFunction · 0.85
pxToTailwindFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected