Predicate Functions
All functions in this group have a signature of * -> Boolean
and are used with the many predicate based functions that ship with crocks
, like safe
, ifElse
and filter
to name a few. They also fit naturally with the Pred
ADT. All predicate functions can be referenced from crocks/predicates
.
Below is a list of all the current predicates that are included with a description of their truth:
hasProp :: (String | Integer) -> a -> Boolean
: anArray
orObject
that contains the provided index or keyhasProps :: Foldable f => f (String | Integer) -> a -> Boolean
: anArray
orObject
that contains the provided indexs or keyshasPropPath :: [ String | Integer ] -> a -> Boolean
: anArray
orObject
that contains the provided index pathisAlt :: a -> Boolean
: an ADT that providesmap
andalt
methodsisAlternative :: a -> Boolean
: an ADT that providesalt
,zero
,map
,ap
,chain
andof
methodsisApplicative :: a -> Boolean
: an ADT that providesmap
,ap
andof
methodsisApply :: a -> Boolean
: an ADT that providesmap
andap
methodsisArray :: a -> Boolean
: ArrayisBifunctor :: a -> Boolean
: an ADT that providesmap
andbimap
methodsisBoolean :: a -> Boolean
: BooleanisCategory :: a -> Boolean
: an ADT that providesid
andcompose
methodsisChain :: a -> Boolean
: an ADT that providesmap
,ap
andchain
methodsisContravariant :: a -> Boolean
: an ADT that providescontramap
methodisDate :: a -> Boolean
: DateisDefined :: a -> Boolean
: Every value that is notundefined
,null
includedisEmpty :: a -> Boolean
: Empty Monoid, Object, Array, String, undefined, null, all Numbers and Boolean valuesisExtend :: a -> Boolean
: an ADT that providesmap
andextend
methodsisFalse :: a -> Boolean
: a value that is strictly equal tofalse
isFalsy :: a -> Boolean
: a value that is considered to befalsy
isFoldable :: a -> Boolean
: Array, List or any structure with areduce
methodisFunction :: a -> Boolean
: FunctionisFunctor :: a -> Boolean
: an ADT that provides amap
methodisInteger :: a -> Boolean
: IntegerisIterable :: a -> Boolean
: anObject
with aniterator
methodisMap :: a -> Boolean
: MapisMonad :: a -> Boolean
: an ADT that providesmap
,ap
,chain
andof
methodsisMonoid :: a -> Boolean
: an ADT that providesconcat
andempty
methodsisNil :: a -> Boolean
:undefined
ornull
orNaN
isNumber :: a -> Boolean
:Number
that is not aNaN
value,Infinity
includedisObject :: a -> Boolean
: Plain Old JavaScript Object (POJO)isPlus :: a -> Boolean
: an ADT that providesmap
,alt
andzero
methodsisProfunctor :: a -> Boolean
: an ADT that providesmap
,contramap
andpromap
methodsisPromise :: a -> Boolean
: an object implementingthen
andcatch
isSame :: a -> b -> Boolean
: same value or reference, useequals
for value equalityisSameType :: a -> b -> Boolean
: Constructor matches a values type, or two values types matchisSemigroup :: a -> Boolean
: an ADT that provides aconcat
methodisSemigroupoid :: a -> Boolean
: an ADT that provides acompose
methodisSetoid :: a -> Boolean
: an ADT that provides anequals
methodisString :: a -> Boolean
: StringisSymbol :: a -> Boolean
: SymbolisTraversable :: a -> Boolean
: an ADT that providesmap
andtraverse
methodsisTrue :: a -> Boolean
: a value that is strictly equal totrue
isTruthy :: a -> Boolean
: a value that is considered to betruthy
pathEq :: [ String | Integer ] -> a -> Object -> Boolean
: anObject
that contains the provided key in the traversal path, with a value equal to the provided value. (equality by value)pathSatisfies :: [ String | Integer ] -> ((a -> Boolean) | Pred) -> Object -> Boolean
: anObject
that contains the provided key in the traversal path with a value that passes the provided predicate.propEq :: (String | Integer) -> a -> Object -> Boolean
: anObject
that contains the provided key with a value equal to the provided value. (equality by value)propSatisfies :: (String | Integer) -> ((a -> Boolean) | Pred) -> Object -> Boolean
: anObject
that contains the provided key with a value that passes the provided predicate.
Contribute on Github! Edit this section.