The only fully tested and API consistent enumerable plugin for jQuery (collect, inject and friends)
MIT License
h1. jquery-enumerable
The only fully tested, API consistent enumerable plugin for jQuery
h2. Quick start
h2. Usage
Every function is passed an index parameter
The following functions are currently implemented
h2. Architecture
These notes are for if you plan to extend the library.
Functions are defined in an object hash, which is subsequently used to extend both jQuery's static functions and iterator functions. The function that you define must take the enumerable object as it's first argument, and the callback as its last (for functions that don't need a callback, such as @sum@, this is not required). This function is decorated with some basic error checking (such as ensuring the callback is valid). In code:
Some test helpers are provided: @expect_result@ and @it_protects_from_invalid_callback@. The ensures an error is raised if an invalid callback function is provided, the former runs the given spec against both the static (@$.new_function@) and iteraton (@$([]).new_function@) version of the function. See the existing suite for examples.