Closed JRJurman closed 3 years ago
@JRJurman object/is
simply confirms whether we deal with a value that's not a primitive.
If your use case is about confirming a JSON non-primitive value (so either plain object or array) it might be more accurate to refer to plain-object/is
and native Array.isArray
(as isPlainObject(value) || Array.isArray(value)
)
Makes sense. Thanks for the prompt answer (and the amazing library)!
Wasn't sure if this is intentional or not, but
object/is
returns true andobject/ensure
passes when you test a function.For my use case I actually need to verify that it is non-primitive, and not a function. In reality, I could understand functions being considered "non-primitive", but it looks like neither
primitive-object
orobject
cover my use case of only objects and arrays, unless I'm missing something...