Sha256: 2553012c10dc2fdf686e52d7e050f04f6bd3d708bfeceee5a14f98d40e6433b9

Contents?: true

Size: 658 Bytes

Versions: 12

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

module Spandx
  module Js
    module Parsers
      class Yarn < ::Spandx::Core::Parser
        def match?(filename)
          filename.basename.fnmatch?('yarn.lock')
        end

        def parse(path)
          YarnLock.new(path).each_with_object(Set.new) do |metadata, memo|
            memo << map_from(path, metadata)
          end
        end

        private

        def map_from(path, metadata)
          ::Spandx::Core::Dependency.new(
            path: path,
            name: metadata['name'],
            version: metadata['version'],
            meta: metadata
          )
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spandx-0.18.3 lib/spandx/js/parsers/yarn.rb
spandx-0.18.2 lib/spandx/js/parsers/yarn.rb
spandx-0.18.1 lib/spandx/js/parsers/yarn.rb
spandx-0.18.0 lib/spandx/js/parsers/yarn.rb
spandx-0.17.0 lib/spandx/js/parsers/yarn.rb
spandx-0.16.1 lib/spandx/js/parsers/yarn.rb
spandx-0.16.0 lib/spandx/js/parsers/yarn.rb
spandx-0.15.1 lib/spandx/js/parsers/yarn.rb
spandx-0.15.0 lib/spandx/js/parsers/yarn.rb
spandx-0.14.0 lib/spandx/js/parsers/yarn.rb
spandx-0.13.5 lib/spandx/js/parsers/yarn.rb
spandx-0.13.4 lib/spandx/js/parsers/yarn.rb