Last change
on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
729 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.isTransparentExprWrapper = isTransparentExprWrapper;
|
---|
| 7 | exports.skipTransparentExprWrappers = skipTransparentExprWrappers;
|
---|
| 8 |
|
---|
| 9 | var _t = require("@babel/types");
|
---|
| 10 |
|
---|
| 11 | const {
|
---|
| 12 | isParenthesizedExpression,
|
---|
| 13 | isTSAsExpression,
|
---|
| 14 | isTSNonNullExpression,
|
---|
| 15 | isTSTypeAssertion,
|
---|
| 16 | isTypeCastExpression
|
---|
| 17 | } = _t;
|
---|
| 18 |
|
---|
| 19 | function isTransparentExprWrapper(node) {
|
---|
| 20 | return isTSAsExpression(node) || isTSTypeAssertion(node) || isTSNonNullExpression(node) || isTypeCastExpression(node) || isParenthesizedExpression(node);
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | function skipTransparentExprWrappers(path) {
|
---|
| 24 | while (isTransparentExprWrapper(path.node)) {
|
---|
| 25 | path = path.get("expression");
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | return path;
|
---|
| 29 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.