Skip to main content

extract_import_spec

Function extract_import_spec 

Source
pub fn extract_import_spec(rest: &str) -> Option<&str>
Expand description

Extracts the relative specifier an import clause resolves against.

Bare specifiers are rejected: only ./ and ../ targets are inlined, because anything else would drag in a module this code does not control.

§Arguments

  • &str - The import clause, without its leading import keyword.

§Returns

  • Option<&str> - The specifier with its quotes stripped, or None when the clause has no from or names a non-relative module.