UNPKG

jscodeshaft

Version:

Collection of more or less primitive helpers and abstractions for JSCodeShift, build for design system migrations and upgrades.

20 lines (16 loc) 513 B
import {isStringMatching} from '../../general'; /** * Determines if given importNode matches against given importPathMatcher. * Returns false on unsupported values. * @param {RegExp|string} importPathMatcher * @param {Node} importNode * @returns {boolean} */ export const isImportMatchedByImportPath = (importPathMatcher, importNode) => { const pathString = importNode?.source?.value; return ( importNode ? isStringMatching(pathString, importPathMatcher) : false ); };