MCPcopy Create free account
hub / github.com/microsoft/typescript-go / GetExternalModuleName

Function GetExternalModuleName

internal/ls/lsutil/organizeimports.go:299–304  ·  view source on GitHub ↗

GetExternalModuleName returns the module name from a module specifier expression.

(specifier *ast.Expression)

Source from the content-addressed store, hash-verified

297
298// GetExternalModuleName returns the module name from a module specifier expression.
299func GetExternalModuleName(specifier *ast.Expression) string {
300 if specifier != nil && ast.IsStringLiteralLike(specifier.AsNode()) {
301 return specifier.Text()
302 }
303 return ""
304}
305
306// CompareModuleSpecifiers compares two module specifiers using the given comparer.
307func CompareModuleSpecifiers(m1 *ast.Expression, m2 *ast.Expression, comparer func(a, b string) int) int {

Callers 3

groupByModuleSpecifierFunction · 0.92
CompareModuleSpecifiersFunction · 0.70

Calls 3

IsStringLiteralLikeFunction · 0.92
AsNodeMethod · 0.65
TextMethod · 0.65

Tested by

no test coverage detected