stoeffel / editable

Home Page:http://package.elm-lang.org/packages/stoeffel/editable/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add `isDirty` command

amitaibu opened this issue · comments

Removed this part from #2 , and added a proper issue to it :)

Maybe we should add something like this?:

isDirtyWith : Editable record -> (record -> record -> Bool) -> Bool
isDirtyWith editableRecord compareFunc =
    case editableRecord of
        ReadOnly _ ->
            False

        Editable originalRecord updatedRecord ->
            compareFunc originalRecord originalRecord


isDirty : Editable record -> Bool
isDirty editableRecord =
    isDirtyWith editableRecord (==)