@rehearsal/utils
Advanced tools
Comparing version 0.0.39 to 1.0.0-beta
{ | ||
"name": "@rehearsal/utils", | ||
"version": "0.0.39", | ||
"version": "1.0.0-beta", | ||
"description": "Rehearsal Utils", | ||
@@ -43,2 +43,3 @@ "keywords": [ | ||
"lint:tsc-src": "tsc --noEmit", | ||
"lint:tsc-test": "tsc --noEmit --project test/tsconfig.json", | ||
"test": "vitest --run", | ||
@@ -45,0 +46,0 @@ "test:watch": "vitest --coverage --watch" |
@@ -108,22 +108,5 @@ /** | ||
export function isNodeInsideJsx(node: Node): boolean { | ||
const visit = (node: Node): boolean => { | ||
if (node === undefined || isSourceFile(node)) { | ||
return false; | ||
} | ||
if (isJsxElement(node) || isJsxFragment(node)) { | ||
return true; | ||
} | ||
return visit(node.parent); | ||
}; | ||
return visit(node); | ||
return findAncestor(node, (node) => isJsxElement(node) || isJsxFragment(node)) !== undefined; | ||
} | ||
export function insertIntoText(text: string, insertAt: number, strToInsert: string): string { | ||
const newText = `${text.substring(0, insertAt)}${strToInsert}${text.substring(insertAt)}`; | ||
return newText; | ||
} | ||
/** | ||
@@ -130,0 +113,0 @@ * Checks if node is a variable passed in catch clause. |
14850
9
370