jscodeshaft
Version:
Collection of more or less primitive helpers and abstractions for JSCodeShift, build for design system migrations and upgrades.
17 lines (14 loc) • 450 B
JavaScript
import {isFunctionCall} from '../../typeChecking';
/**
* @typedef {function} isFunctionCallOfArgs
* @param {string} fname Function name
* @returns {void}
*//**
* Tests whether function call expression matches given fn name
* @param {object} node Call Expression node to test
* @return {isFunctionCallOfArgs}
*/
export const isFunctionCallOf = ({value}) => fname => (
isFunctionCall(value)
&& value.callee.name === fname
);