instance method
extract_base_package_name
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.2.3 PrivateSignature
extract_base_package_name(package)
No documentation comment.
Parameters
-
packagereq
Source
# File lib/importmap/npm.rb, line 145
def extract_base_package_name(package)
if package.start_with?("@")
# Scoped packages can have nested paths, e.g. @scope/package/subpath
parts = package.split("/", 3)
parts.size > 2 ? parts.first(2).join("/") : package
else
# Non-scoped packages - just take the first part
package.split("/").first
end
end
Defined in lib/importmap/npm.rb line 145
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Importmap::Npm