Packages
guardian
0.14.3
2.4.0
2.3.2
2.3.1
2.3.0
2.2.4
2.2.3
2.2.2
2.2.1
2.2.0
2.1.2
2.1.1
2.0.0
1.2.1
1.2.0
retired
1.1.1
1.1.0
1.0.1
1.0.0
1.0.0-beta.1
1.0.0-beta.0
0.14.6
0.14.5
0.14.4
0.14.3
retired
0.14.2
0.14.1
0.14.0
0.13.0
0.12.0
0.11.1
0.10.1
0.10.0
0.9.1
0.9.0
0.8.1
0.8.0
0.7.4
0.7.2
0.7.1
0.7.0
0.6.3
0.6.2
0.6.1
0.6.0
0.5.2
0.5.0
0.4.1
0.4.0
0.3.1
0.3.0
0.2.0
0.1.1
0.1.0
Elixir Authentication framework
Retired package: Release invalid
Current section
Files
Jump to
Current section
Files
lib/guardian/utils.ex
defmodule Guardian.Utils do
@moduledoc false
@doc false
def stringify_keys(nil), do: %{}
def stringify_keys(map) do
Enum.reduce_while(map, nil, fn
{key, _}, nil when is_binary(key) -> {:cont, nil}
_, _ -> {:halt, do_stringify_keys(map)}
end) || map
end
defp do_stringify_keys(map) do
Enum.reduce(map, Map.new, fn {key, value}, acc ->
Map.put(acc, to_string(key), value)
end)
end
@doc false
def timestamp do
{mgsec, sec, _usec} = :os.timestamp
mgsec * 1_000_000 + sec
end
end