Skip to main content

toClassNamesList


function toClassNamesList(
input: IClassNamesListLike,
): IClassNamesList
type IClassNamesListAsString = string;
type IClassNamesListAsIterable = Iterable<string>;

type IClassNamesListLike =
| IClassNamesList
| IClassNamesListAsString
| IClassNamesListAsIterable
;

Definition​

Converts a string, an Iterable<string> or a Set<string> into a IClassNamesList (alias for Set<string>).

Useful when we have to cast a non-normalized value to a list of class names.

Example​

const classNamesListRaw$ = single(['class-a', 'class-b']);
const classNamesList$ = map$$(classNamesListRaw$, toClassNamesList);

node.setReactiveClassNamesList(classNamesList$);