@esportsplus/typescript 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,3 @@
1
1
  export * from './expression.js';
2
2
  export * from './range.js';
3
+ export * from './visitor.js';
@@ -1,2 +1,3 @@
1
1
  export * from './expression.js';
2
2
  export * from './range.js';
3
+ export * from './visitor.js';
@@ -0,0 +1,3 @@
1
+ import ts from 'typescript';
2
+ declare const hasMatch: (node: ts.Node, predicate: (n: ts.Node) => boolean) => boolean;
3
+ export { hasMatch };
@@ -0,0 +1,8 @@
1
+ import ts from 'typescript';
2
+ const hasMatch = (node, predicate) => {
3
+ if (predicate(node)) {
4
+ return true;
5
+ }
6
+ return !!ts.forEachChild(node, child => hasMatch(child, predicate) || undefined);
7
+ };
8
+ export { hasMatch };
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "type": "module",
39
39
  "types": "build/index.d.ts",
40
- "version": "0.19.0",
40
+ "version": "0.20.0",
41
41
  "scripts": {
42
42
  "build": "tsc && tsc-alias",
43
43
  "-": "-"
@@ -1,2 +1,3 @@
1
1
  export * from './expression';
2
2
  export * from './range';
3
+ export * from './visitor';
@@ -0,0 +1,13 @@
1
+ import ts from 'typescript';
2
+
3
+
4
+ const hasMatch = (node: ts.Node, predicate: (n: ts.Node) => boolean): boolean => {
5
+ if (predicate(node)) {
6
+ return true;
7
+ }
8
+
9
+ return !!ts.forEachChild(node, child => hasMatch(child, predicate) || undefined);
10
+ };
11
+
12
+
13
+ export { hasMatch };