Sha256: 6ceea4dc31b976cc5449dc0791460b3d67186a4f14917beaff0d7cfd82b06234

Contents?: true

Size: 239 Bytes

Versions: 1

Compression:

Stored size: 239 Bytes

Contents

# frozen_string_literal: true

class Array
  # @param threshold [Integer] default 1
  # @return [*] first items that appears more than `threshold` times
  def first_dupe(threshold = 1)
    find { |item| count(item) > threshold }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
first_dupe_extension-0.0.1 lib/first_dupe_extension.rb