MCPcopy Index your code
hub / github.com/MALSync/MALSync / getPixel

Function getPixel

src/floatbutton/extension.ts:29–38  ·  view source on GitHub ↗
(val: string, screenSize: number)

Source from the content-addressed store, hash-verified

27}
28
29function getPixel(val: string, screenSize: number): number {
30 if (/^\d+px$/i.test(val)) {
31 return parseInt(val.replace(/px/i, ''));
32 }
33 if (/^\d+%$/i.test(val)) {
34 const proz = parseInt(val.replace(/%/i, ''));
35 return parseInt(`${screenSize * (proz / 100)}`);
36 }
37 return NaN;
38}

Callers 1

openMinimalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected