variable.d.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * Search a particular variable in a list
  3. * @param {Array} variables The variables list.
  4. * @param {string} name The name of the variable to search.
  5. * @returns {boolean} True if the variable was found, false if not.
  6. */
  7. export function findVariable(variables: any[], name: string): boolean;
  8. /**
  9. * Find a variable by name in the current scope.
  10. * @param {Object} context The current rule context.
  11. * @param {ASTNode} node The node to check. Must be an Identifier node.
  12. * @param {string} name Name of the variable to look for.
  13. * @returns {ASTNode|null} Return null if the variable could not be found, ASTNode otherwise.
  14. */
  15. export function findVariableByName(context: any, node: ASTNode, name: string): ASTNode | null;
  16. /**
  17. * Find and return a particular variable in a list
  18. * @param {Array} variables The variables list.
  19. * @param {string} name The name of the variable to search.
  20. * @returns {Object} Variable if the variable was found, null if not.
  21. */
  22. export function getVariable(variables: any[], name: string): any;
  23. /**
  24. * Searches for a variable in the given scope.
  25. *
  26. * @param {Object} context The current rule context.
  27. * @param {ASTNode} node The node to start looking from.
  28. * @param {string} name The name of the variable to search.
  29. * @returns {Object | undefined} Variable if the variable was found, undefined if not.
  30. */
  31. export function getVariableFromContext(context: any, node: ASTNode, name: string): any | undefined;
  32. /**
  33. * Returns the latest definition of the variable.
  34. * @param {Object} variable
  35. * @returns {Object | undefined} The latest variable definition or undefined.
  36. */
  37. export function getLatestVariableDefinition(variable: any): any | undefined;
  38. //# sourceMappingURL=variable.d.ts.map