How to use the isImportNamespaceSpecifier function from @babel/types
Find comprehensive JavaScript @babel/types.isImportNamespaceSpecifier code examples handpicked from public code repositorys.
GitHub: facebook/fbt
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);
186
0
43
+ 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); }
3
13
21
@babel/types.identifier is the most popular function in @babel/types (20936 examples)