function getDefaultNamespace(module) {
  return module.match(/([^/:]+)$/)[1].replace(/\.[^.]+$/, "");
}
Returns the namespace of an imported module or `null` if the namespace is removed.

Example: no import found, possibly using global function
`@use "sass:color";`
`moduleNamespace(root, 'sass:map')` returns 'map'

Example: default namespace
`@use "sass:map";`
`moduleNamespace(root, 'sass:map')` returns `map`

Example: custom namespace
`@use "sass:map" as ns;`
`moduleNamespace(root, 'sass:map')` returns 'ns'

Example: no namespace
`@use "sass:map" as *;`
`moduleNamespace(root, 'sass:map')` returns `null`

Have a look at the tests for more examples.