2021-10-27 15:23:28 +05:30
|
|
|
# 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-12-11 22:18:48 +05:30
|
|
|
|
|
|
|
def self.table_name_prefix
|
|
|
|
'packages_npm_'
|
|
|
|
end
|
2021-10-27 15:23:28 +05:30
|
|
|
end
|
|
|
|
end
|