MCPcopy Create free account
hub / github.com/angular/components / normalizeDuration

Function normalizeDuration

src/material/tabs/paginated-tab-header.ts:67–77  ·  view source on GitHub ↗
(value: string | number)

Source from the content-addressed store, hash-verified

65
66/** Normalizes an animation duration value. */
67export function normalizeDuration(value: string | number): string {
68 const stringValue = value + '';
69
70 if (/^[0-9]+(?:\.[0-9]+)?$/.test(stringValue)) {
71 return `${value}ms`;
72 } else if (/^[0-9]+(?:\.[0-9]+)?(?:ms|s)$/.test(stringValue)) {
73 return stringValue;
74 } else {
75 return '';
76 }
77}
78
79/**
80 * Base class for a tab header that supported pagination.

Callers 1

animationDurationMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected