UNPKG

babel-helper-decorate-react

Version:
20 lines (19 loc) 507 B
export const isScopeDepthPassed = (path, detectScopeDepth) => { if (detectScopeDepth == null || detectScopeDepth < 0) { return true; } let t = detectScopeDepth; let scope = path.scope; do { scope = scope.parent; if (t === 0 && !scope) { return true; } t--; } while (t >= 0 && scope); return false; }; export const replaceAdvancedWith = (path, replacement) => { const rlt = path.replaceWith(replacement); return rlt; };