Sha256: 2c420eb19a5ef5754150d4c8c26f2a21e8522f94b007a049a1750ea02be28440

Contents?: true

Size: 466 Bytes

Versions: 90

Compression:

Stored size: 466 Bytes

Contents

require_relative "version"

class VersionSyntaxConverter
  def rubygem_to_npm(rubygem_version = ReactOnRails::VERSION)
    regex_match = rubygem_version.match(/(\d+\.\d+\.\d+)[.\-]?(.+)?/)
    return "#{regex_match[1]}-#{regex_match[2]}" if regex_match[2]

    regex_match[1].to_s
  end

  def npm_to_rubygem(npm_version)
    match = npm_version
            .tr("-", ".")
            .strip
            .match(/(\d.*)/)
    match.present? ? match[0] : nil
  end
end

Version data entries

90 entries across 90 versions & 1 rubygems

Version Path
react_on_rails-8.0.1 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-8.0.0 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-8.0.0.beta.3 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-8.0.0.beta.2 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-8.0.0.beta.1 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-7.1.0.beta.3 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-7.0.4 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-7.1.0.beta.2 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-7.0.3 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-7.1.0.beta.1 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-7.0.2 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-7.0.1 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-7.0.0 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-6.10.1 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-6.10.0 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-6.9.3 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-6.9.2 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-6.9.1 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-6.9.0 lib/react_on_rails/version_syntax_converter.rb
react_on_rails-6.8.2 lib/react_on_rails/version_syntax_converter.rb