evilsoft / crocks

A collection of well known Algebraic Data Types for your utter enjoyment.
https://crocks.dev
ISC License
1.59k stars 102 forks source link

Adding new `hasProps` predicate #417

Closed dalefrancis88 closed 5 years ago

dalefrancis88 commented 5 years ago

This will allow us to pass an array of keys instead of a single key to check the structure of an object.

Have some things to point out

  1. Are we ok with the use of every? I'm not married to it and am happy to convert it to reduce
  2. Right now it doesn't support taking either the Array or the single value, do we want to do that?
  3. Is that the correct way to specify the expected values in an Array? I see that everywhere else we're using just Array but it'd be nice to be more specific in the signature
coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling b2e00663c486242949e6cc16454bf4281fe59d39 on feature/hasprops into 7d10f722322684dcf489712d10e428d795665571 on master.

dalefrancis88 commented 5 years ago

Yeah i am much more leaning towards the foldable. Expecially since we're trying to increase support for foldable over arrays. Thanks for the suggestion, i'll make the updates and resubmit

dalefrancis88 commented 5 years ago

Do we want to accept an empty foldable and have it return true? I think that's perfectly acceptable