add `filter/3` function (from jsonfilter)