is-collection

Evaluates obj to determine if it's an array, an array-like collection, or
something else. This is useful when working with the function arguments
collection, NodeLists and HTMLElement collections.

Note: This implementation doesn't consider elements that are also
collections, such as <form> and <select>, to be array-like.

Installation

$ component install timoxley/is-collection

Usage

isCollection(document.querySelectorAll('div')) // => truthy (2)
isCollection([]) // => truthy (1)

function() {
  return isCollection(arguments)
}() // => truthy (2)

API

isCollection(object)

Takes an object and returns a number indicating the results of the test:

Credit

Original code adapted from
YUI.

License

BSD