MCPcopy Create free account
hub / github.com/angular/angular / getClassListFromValue

Function getClassListFromValue

packages/core/src/animation/utils.ts:276–291  ·  view source on GitHub ↗
(
  value: string | AnimationClassBindingFn | AnimationClassValue,
)

Source from the content-addressed store, hash-verified

274 * Gets the list of classes from a passed in value
275 */
276export function getClassListFromValue(
277 value: string | AnimationClassBindingFn | AnimationClassValue,
278): string[] | null {
279 let classes: AnimationClassValue = typeof value === 'function' ? value() : value;
280 while (typeof classes === 'function') {
281 classes = classes();
282 }
283 let classList: string[] | null = Array.isArray(classes) ? classes : null;
284 if (typeof classes === 'string') {
285 classList = classes
286 .trim()
287 .split(/\s+/)
288 .filter((k) => k);
289 }
290 return classList;
291}
292
293/**
294 * Removes a list of CSS classes from an element using the provided renderer.

Callers 2

runEnterAnimationFunction · 0.90
runLeaveAnimationsFunction · 0.90

Calls 3

valueFunction · 0.85
isArrayMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected