Skip to content

Commit

Permalink
Pattern match for nil (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
sn3p authored Dec 21, 2017
1 parent de4897a commit 9e4ae78
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/ex_cell/adapters/cell_js.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ defmodule ExCell.Adapters.CellJS do
The data_attribute function is used to build up the data attributes and set
the default `data-cell` and `data-cell-params` attributes.
"""
def data_attribute(name, id, data \\ [], params \\ %{}), do:
def data_attribute(name, id, data \\ [], params \\ %{})
def data_attribute(name, id, nil, params), do:
data_attribute(name, id, [], params)
def data_attribute(name, id, data, params), do:
Keyword.merge(
data || [],
data,
cell: name,
cell_id: id,
cell_params: Poison.encode!(params)
Expand Down

0 comments on commit 9e4ae78

Please sign in to comment.