factored out $parse from checkValue. checkValue now takes an item and a compare function