@flowgram.ai/variable-core 0.1.18 → 0.1.21

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.
package/dist/esm/index.js CHANGED
@@ -148,6 +148,28 @@ var postConstructAST = () => (target, propertyKey) => {
148
148
  }
149
149
  };
150
150
 
151
+ // src/ast/match.ts
152
+ var ASTMatch;
153
+ ((ASTMatch2) => {
154
+ ASTMatch2.isString = (node) => node?.kind === "String" /* String */;
155
+ ASTMatch2.isNumber = (node) => node?.kind === "Number" /* Number */;
156
+ ASTMatch2.isBoolean = (node) => node?.kind === "Boolean" /* Boolean */;
157
+ ASTMatch2.isInteger = (node) => node?.kind === "Integer" /* Integer */;
158
+ ASTMatch2.isObject = (node) => node?.kind === "Object" /* Object */;
159
+ ASTMatch2.isArray = (node) => node?.kind === "Array" /* Array */;
160
+ ASTMatch2.isMap = (node) => node?.kind === "Map" /* Map */;
161
+ ASTMatch2.isCustomType = (node) => node?.kind === "CustomType" /* CustomType */;
162
+ ASTMatch2.isVariableDeclaration = (node) => node?.kind === "VariableDeclaration" /* VariableDeclaration */;
163
+ ASTMatch2.isProperty = (node) => node?.kind === "Property" /* Property */;
164
+ ASTMatch2.isVariableDeclarationList = (node) => node?.kind === "VariableDeclarationList" /* VariableDeclarationList */;
165
+ ASTMatch2.isEnumerateExpression = (node) => node?.kind === "EnumerateExpression" /* EnumerateExpression */;
166
+ ASTMatch2.isKeyPathExpression = (node) => node?.kind === "KeyPathExpression" /* KeyPathExpression */;
167
+ function is(node, targetType) {
168
+ return node?.kind === targetType?.kind;
169
+ }
170
+ ASTMatch2.is = is;
171
+ })(ASTMatch || (ASTMatch = {}));
172
+
151
173
  // src/ast/utils/helpers.ts
152
174
  function updateChildNodeHelper({
153
175
  getChildNode,
@@ -183,7 +205,7 @@ function getAllChildren(ast) {
183
205
  return [...ast.children, ...ast.children.map((_child) => getAllChildren(_child)).flat()];
184
206
  }
185
207
  function isMatchAST(node, targetType) {
186
- return node?.kind === targetType?.kind;
208
+ return ASTMatch.is(node, targetType);
187
209
  }
188
210
 
189
211
  // src/ast/flags.ts
@@ -2019,6 +2041,7 @@ function useAvailableVariables() {
2019
2041
  export {
2020
2042
  ASTFactory,
2021
2043
  ASTKind,
2044
+ ASTMatch,
2022
2045
  ASTNode,
2023
2046
  ASTNodeFlags,
2024
2047
  ASTRegisters,