hissssst / pathex

Fastest tool to access data in Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exists?/2 bug

hissssst opened this issue · comments

iex> s = [
  %{
    children: [
      %{
        children: [],
        id: "fcfb1066-6e16-4a84-81e0-7746f12b7e76",
        tag: "test1",
        type: "section"
      },
      %{
        id: "035ca737-2cc2-488b-83f5-fe7cc2becc5e",
        parent_id: "a9963499-f6a4-4a32-bafa-aa22a9b059bc"
      },
      %{
        children: [
          %{
            other: [
              %{
                id: "035ca737-2cc2-488b-83f5-fe7cc2becc5e",
                parent_id: "a9963499-f6a4-4a32-bafa-aa22a9b059bc"
              }
            ],
            tag: "test4"
          }
        ],
        id: "8a9f0126-33a0-4c03-8c4a-5507f0562c8a",
        index: 2,
        parent: "layout",
        parent_id: "a9963499-f6a4-4a32-bafa-aa22a9b059bc",
        tag: "test2",
        type: "section"
      }
    ],
    parent: "dragLocation",
    parent_id: "dragLocation",
    tag: "test3"
  }
]

iex> Pathex.view s, tag_lens ~> matching("test2")
{:ok, "test2"}

iex> Pathex.exists? s, tag_lens ~> matching("test2")
** (CaseClauseError) no case clause matching: true
    (pathex 2.5.0) lib/pathex/lenses/some.ex:186: Pathex.Lenses.Some.map_view/2
    iex:6: (file)
    iex:6: (file)
    iex:6: (file)
    iex:9: (file)