def unique.go
bend-kit-json@0.7.0.0 · json.bend:826
import bend-kit-json@0.7.0.0/json.bend as Json
import Base
826
827
828
829def unique.go(v: Val) -> Val & Bool & List<&2, List<&2, U32>>:
830 match v:
831 case Null{}:
832 (Null{}, True{}, Nil{})
833 case Flag{on}:
834 (Flag{on}, True{}, Nil{})
835 case Num{s}:
836 (Num{s}, True{}, Nil{})
837 case Str{s}:
838 (Str{s}, True{}, Nil{})
839 case Arr{Nil{}}:
840 (Arr{Nil{}}, True{}, Nil{})
841 case Arr{Con{head, tail}}:
842 unique.array(unique.go(head), unique.go(Arr{tail}))
843 case Obj{Nil{}}:
844 (Obj{Nil{}}, True{}, Nil{})
845 case Obj{(key, head) <> tail}:
846 unique.object(key, unique.go(head), unique.go(Obj{tail}))