zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

utils.ex (448B)


      1 defmodule Absinthe.Type.BuiltIns.Scalars.Utils do
      2   @moduledoc false
      3 
      4   # Parse, supporting pulling values out of AST nodes
      5   defmacro parse_with(node_types, coercion) do
      6     quote do
      7       fn
      8         %{value: value} = node ->
      9           if Enum.member?(unquote(node_types), node) do
     10             unquote(coercion).(value)
     11           else
     12             nil
     13           end
     14 
     15         other ->
     16           unquote(coercion).(other)
     17       end
     18     end
     19   end
     20 end