nodes.js 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.isVariableDeclaration = exports.isThrowStatement = exports.isReturnStatement = exports.isObjectExpression = exports.isModuleDeclaration = exports.isMemberExpression = exports.isLogicalExpression = exports.isLiteral = exports.isIfStatement = exports.isIdentifier = exports.isFunctionExpression = exports.isFunctionDeclaration = exports.isExpressionStatement = exports.isContinueStatement = exports.isConditionalExpression = exports.isCallExpression = exports.isBooleanLiteral = exports.isBlockStatement = exports.isBinaryExpression = exports.isAssignmentExpression = exports.isArrowFunctionExpression = void 0;
  4. const MODULE_DECLARATION_NODES = [
  5. 'ImportDeclaration',
  6. 'ExportNamedDeclaration',
  7. 'ExportDefaultDeclaration',
  8. 'ExportAllDeclaration',
  9. ];
  10. function isArrowFunctionExpression(node) {
  11. return node !== undefined && node.type === 'ArrowFunctionExpression';
  12. }
  13. exports.isArrowFunctionExpression = isArrowFunctionExpression;
  14. function isAssignmentExpression(node) {
  15. return node !== undefined && node.type === 'AssignmentExpression';
  16. }
  17. exports.isAssignmentExpression = isAssignmentExpression;
  18. function isBinaryExpression(node) {
  19. return node !== undefined && node.type === 'BinaryExpression';
  20. }
  21. exports.isBinaryExpression = isBinaryExpression;
  22. function isBlockStatement(node) {
  23. return node !== undefined && node.type === 'BlockStatement';
  24. }
  25. exports.isBlockStatement = isBlockStatement;
  26. function isBooleanLiteral(node) {
  27. return isLiteral(node) && typeof node.value === 'boolean';
  28. }
  29. exports.isBooleanLiteral = isBooleanLiteral;
  30. function isCallExpression(node) {
  31. return node !== undefined && node.type === 'CallExpression';
  32. }
  33. exports.isCallExpression = isCallExpression;
  34. function isConditionalExpression(node) {
  35. return node !== undefined && node.type === 'ConditionalExpression';
  36. }
  37. exports.isConditionalExpression = isConditionalExpression;
  38. function isContinueStatement(node) {
  39. return node !== undefined && node.type === 'ContinueStatement';
  40. }
  41. exports.isContinueStatement = isContinueStatement;
  42. function isExpressionStatement(node) {
  43. return node !== undefined && node.type === 'ExpressionStatement';
  44. }
  45. exports.isExpressionStatement = isExpressionStatement;
  46. function isFunctionDeclaration(node) {
  47. return node !== undefined && node.type === 'FunctionDeclaration';
  48. }
  49. exports.isFunctionDeclaration = isFunctionDeclaration;
  50. function isFunctionExpression(node) {
  51. return node !== undefined && node.type === 'FunctionExpression';
  52. }
  53. exports.isFunctionExpression = isFunctionExpression;
  54. function isIdentifier(node) {
  55. return node !== undefined && node.type === 'Identifier';
  56. }
  57. exports.isIdentifier = isIdentifier;
  58. function isIfStatement(node) {
  59. return node !== undefined && node.type === 'IfStatement';
  60. }
  61. exports.isIfStatement = isIfStatement;
  62. function isLiteral(node) {
  63. return node !== undefined && node.type === 'Literal';
  64. }
  65. exports.isLiteral = isLiteral;
  66. function isLogicalExpression(node) {
  67. return node !== undefined && node.type === 'LogicalExpression';
  68. }
  69. exports.isLogicalExpression = isLogicalExpression;
  70. function isMemberExpression(node) {
  71. return node !== undefined && node.type === 'MemberExpression';
  72. }
  73. exports.isMemberExpression = isMemberExpression;
  74. function isModuleDeclaration(node) {
  75. return node !== undefined && MODULE_DECLARATION_NODES.includes(node.type);
  76. }
  77. exports.isModuleDeclaration = isModuleDeclaration;
  78. function isObjectExpression(node) {
  79. return node !== undefined && node.type === 'ObjectExpression';
  80. }
  81. exports.isObjectExpression = isObjectExpression;
  82. function isReturnStatement(node) {
  83. return node !== undefined && node.type === 'ReturnStatement';
  84. }
  85. exports.isReturnStatement = isReturnStatement;
  86. function isThrowStatement(node) {
  87. return node !== undefined && node.type === 'ThrowStatement';
  88. }
  89. exports.isThrowStatement = isThrowStatement;
  90. function isVariableDeclaration(node) {
  91. return node !== undefined && node.type === 'VariableDeclaration';
  92. }
  93. exports.isVariableDeclaration = isVariableDeclaration;
  94. //# sourceMappingURL=nodes.js.map