How to use the isImportNamespaceSpecifier function from @babel/types

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

95
96
97
98
99
100
101
102
103
104
}

const specifier = node.specifiers[0];
if (
  t.isImportDefaultSpecifier(specifier) ||
  t.isImportNamespaceSpecifier(specifier)
) {
  const alias = specifier.local.name;
  const modulePath = node.source.value;
  this.setModuleAlias(alias, modulePath);
fork icon186
star icon0
watch icon43

+ 5 other calls in file

78
79
80
81
82
83
84
85
86
87

node.specifiers.forEach((specifier) => {
  if (t.isImportSpecifier(specifier)) {
    // import { foo } from 'foo';
    importDeclaration.bindings.push(specifier.imported.name);
  } else if (t.isImportDefaultSpecifier(specifier) || t.isImportNamespaceSpecifier(specifier)) {
    // DefaultSpecifier   - import baz from 'foo';
    // NamespaceSpecifier - import * as baz from 'foo';
    importDeclaration.bindings.push(specifier.local.name);
  }
fork icon3
star icon13
watch icon21

Other functions in @babel/types

Sorted by popularity

function icon

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