Sha256: ed03b8aec9b7b63b0058937cacab37329903da151b8b79dc5ebc9f64a9969ead

Contents?: true

Size: 606 Bytes

Versions: 4

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

module Licensee
  module Matchers
    class NpmBower < Licensee::Matchers::Package
      # While we could parse the package.json or bower.json file, prefer
      # a lenient regex for speed and security. Moar parsing moar problems.
      LICENSE_REGEX = /
        \s*["']license["']\s*:\s*['"]([a-z\-0-9.+ ()]+)['"],?\s*
      /ix

      private

      def license_property
        match = @file.content.match LICENSE_REGEX
        return unless match && match[1]
        return 'no-license' if match[1] == 'UNLICENSED'

        match[1].downcase
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
licensee-9.18.0 lib/licensee/matchers/npm_bower.rb
licensee-9.17.1 lib/licensee/matchers/npm_bower.rb
licensee-9.17.0 lib/licensee/matchers/npm_bower.rb
licensee-9.16.1 lib/licensee/matchers/npm_bower.rb