Fork me on GitHub

jQuery Combinations Plugin

Description

jQuery Combinations Plugin is a simple utility method used to create an array of every possible combination derived from an array of arrays

Usage is simple, just pass an array of arrays chaning next commit to the combinations method:

$.combinations([[1,2], ["A", "B", "C"]]);

...and it returns an array of the combinations between the arrays:

returns [[1,"A"], [2,"A"], [1,"B"], [2,"B"], [1,"C"], [2,"C"]]

Examples

Some possible usages could be for a complex filtering system, where you know the user has many options and you'll need to create an instance of something for every possible combination.

Gender

Hair

Outfit

Pet