debian-mirror-gitlab/app/models/packages/npm.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
442 B
Ruby
Raw Normal View History

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