Skip to content

Commit

Permalink
Fixed: Performance regression on Faker.Util.pick/1 (#214)
Browse files Browse the repository at this point in the history
* added range matching clause to Faker.Util.pick/1 to avoid enumeration

* removed whitespace around Faker.Util.pick/1
  • Loading branch information
elbow-jason authored and Igor Kapkov committed Nov 21, 2018
1 parent f78d40e commit 9339bb4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/faker/util.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ defmodule Faker.Util do
"2"
"""
@spec pick(Enum.t()) :: any
def pick(low..high) do
Faker.random_between(low, high)
end

def pick(enum) do
enum
|> Enum.to_list()
Expand Down

0 comments on commit 9339bb4

Please sign in to comment.