2021-08-06 11:10:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
module Packages
|
|
|
|
module Npm
|
|
|
|
# from "@scope/package-name" return "scope" or nil
|
|
|
|
def self.scope_of(package_name)
|
|
|
|
return unless package_name
|
|
|
|
return unless package_name.starts_with?('@')
|
|
|
|
return unless package_name.include?('/')
|
|
|
|
|
|
|
|
package_name.match(Gitlab::Regex.npm_package_name_regex)&.captures&.first
|
|
|
|
end
|
2021-11-10 13:12:35 -05:00
|
|
|
|
|
|
|
def self.table_name_prefix
|
|
|
|
'packages_npm_'
|
|
|
|
end
|
2021-08-06 11:10:05 -04:00
|
|
|
end
|
|
|
|
end
|