Returns true if the data type is a natural holder of other items, also known as a "collection" (eg Array, Object, Set, Map) but Many is also Iterator, Generator, arguments etc, hence the name isMany instead of isCollection.
It's also the opposite of z.isSingle() in terms of naturally/normally having compound or many items (eg props, array items etc) nested inside it.
Not iterable at all, they don't reveal their items, but they are still "many" types
'WeakSet'
'WeakMap'
Note
class types makes sense to be categorised as "Many", because a class can have interesting static props.
Normal 'function' is not normally a "Many" type (many values holder), although in theory it can hold props. Same applies to Boxed primitives like String, Number etc, which represent a single value (not many), but they can have properties (very rare & bad practice though). You need to enforce this check in your code.
@note: On all of these "Many" types (except WeakSet/WeakMap which aren't revealing their items), you can use z.loop(value) to get an IterableIterator of [keyOrIdx, value] pairs, which works the same way for all of them.
It also has an option allProps that deals with props on all _.isObject values.
Returns
trueif the data type is a natural holder of other items, also known as a "collection" (eg Array, Object, Set, Map) but Many is also Iterator, Generator, arguments etc, hence the nameisManyinstead ofisCollection.It's also the opposite of
z.isSingle()in terms of naturally/normally having compound or many items (eg props, array items etc) nested inside it.As defined in
MANY_NAMES, they are:'object''Array''Set''Map''class'// see notes'arguments''Generator''Iterator''AsyncGenerator''AsyncIterator'Not iterable at all, they don't reveal their items, but they are still "many" types
'WeakSet''WeakMap'Note
class types makes sense to be categorised as "Many", because a class can have interesting static props.
Normal 'function' is not normally a "Many" type (many values holder), although in theory it can hold props. Same applies to Boxed primitives like
String,Numberetc, which represent a single value (not many), but they can have properties (very rare & bad practice though). You need to enforce this check in your code.@note: On all of these "Many" types (except
WeakSet/WeakMapwhich aren't revealing their items), you can usez.loop(value)to get anIterableIteratorof[keyOrIdx, value]pairs, which works the same way for all of them.It also has an option
allPropsthat deals with props on all_.isObjectvalues.See
z.isSingle()is the opposite ofisManyz.isPrimitive()for the most basic single typesz.loop(value)to iterate onisMany()values (that makes sense).MANY_NAMESfor the string list of types that are considered "Many" types.Manythe types that are considered "Many".isManyTypeto check if a type (not a value) is a "Many" type.