How to use the directive function from @babel/types

Find comprehensive JavaScript @babel/types.directive code examples handpicked from public code repositorys.

7
8
9
10
11
12
13
14
15
16

        for (const directive of node.directives) {
          if (directive.value.value === 'use babel') return;
        }

        path.unshiftContainer('directives', t.directive(t.directiveLiteral('use babel')));
      },
    },
  };
}
fork icon1
star icon1
watch icon1

89
90
91
92
93
94
95
96
97
98
  const hasStrict = path.node.directives.some(directive => {
    return directive.value.value === "use strict";
  });

  if (!hasStrict) {
    path.unshiftContainer("directives", t.directive(t.directiveLiteral("use strict")));
  }
}

const headers = [];
fork icon0
star icon1
watch icon1

+ 21 other calls in file

Other functions in @babel/types

Sorted by popularity

function icon

@babel/types.identifier is the most popular function in @babel/types (20936 examples)