jscodeshaft
Version:
Collection of more or less primitive helpers and abstractions for JSCodeShift, build for design system migrations and upgrades.
15 lines (12 loc) • 428 B
JavaScript
import { isExpression } from '../../typeChecking';
/**
* Determines whether given className attribute's is an expression,
* following the syntax of (for example):
* classNames={whatever} or classNames={whatever()}, etc
* @param {Node} classNameAttr
* @returns {boolean}
*/
export const isClassNameExpression = (classNameAttr) => (
isExpression(classNameAttr.value)
&& Boolean(classNameAttr.value.expression)
);