javascript-collections-framework
    Preparing search index...

    Function isCollection

    • Returns whether value is a collection from this library — any collection, view or read-only wrapper of the same major version, from any loaded copy of the package. Maps, arrays and native Set/Map are not.

      Time: O(1), plus any getter or proxy trap that reading a property of value runs.

      Parameters

      • value: unknown

        Any value.

      Returns value is ReadonlyCollection<unknown>

      true when value is a library collection.

      whatever a getter or proxy trap on value throws while the property is read.

      function count(value: unknown): number {
      return isCollection(value) ? value.size : 0
      }