MCPcopy
hub / github.com/chartjs/Chart.js / toLineHeight

Function toLineHeight

src/helpers/helpers.options.ts:22–41  ·  view source on GitHub ↗
(value: number | string, size: number)

Source from the content-addressed store, hash-verified

20 * @since 2.7.0
21 */
22export function toLineHeight(value: number | string, size: number): number {
23 const matches = ('' + value).match(LINE_HEIGHT);
24 if (!matches || matches[1] === 'normal') {
25 return size * 1.2;
26 }
27
28 value = +matches[2];
29
30 switch (matches[3]) {
31 case 'px':
32 return value;
33 case '%':
34 value /= 100;
35 break;
36 default:
37 break;
38 }
39
40 return size * value;
41}
42
43const numberOrZero = (v: unknown) => +v || 0;
44

Callers 2

toFontFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected