Sha256: 7ac2685de571e6d493ce6c57451479571976b25b2f6dde5fd5fe09b7d9203e0b

Contents?: true

Size: 354 Bytes

Versions: 7

Compression:

Stored size: 354 Bytes

Contents

# frozen_string_literal: true

module JsDependency
  module PathnameUtility
    def self.complement_extname(pathname)
      return pathname if pathname.exist? || pathname.extname != ""

      %w[.js .jsx .vue].each do |ext|
        next unless pathname.sub_ext(ext).file?

        return pathname.sub_ext(ext)
      end

      pathname
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
js_dependency-0.2.3.1 lib/js_dependency/pathname_utility.rb
js_dependency-0.2.3 lib/js_dependency/pathname_utility.rb
js_dependency-0.2.2 lib/js_dependency/pathname_utility.rb
js_dependency-0.2.1 lib/js_dependency/pathname_utility.rb
js_dependency-0.2.0 lib/js_dependency/pathname_utility.rb
js_dependency-0.1.1 lib/js_dependency/pathname_utility.rb
js_dependency-0.1.0 lib/js_dependency/pathname_utility.rb