Debian Codegraph @

packages/babel-types/src/validators/isSpecifierDefault.ts

raw
1 import { isIdentifier, isImportDefaultSpecifier } from "./generated";
2 import type * as t from "..";
3
4 /**
5 * Check if the input `specifier` is a `default` import or export.
6 */
7 export default function isSpecifierDefault(
8 specifier: t.ModuleSpecifier,
9 ): boolean {
10 return (
11 isImportDefaultSpecifier(specifier) ||
12 // @ts-expect-error todo(flow->ts): stricter type for specifier
13 isIdentifier(specifier.imported || specifier.exported, {
14 name: "default",
15 })
16 );
17 }