function index(element, key, items) {
    var prefix = '--' + key;
    var cssVar = prefix + "-index";

    each(items, function (items, i) {
        if (Array.isArray(items)) {
            each(items, function(item) {
                setProperty(item, cssVar, i);
            });
        } else {
            setProperty(items, cssVar, i);
        }
    });

    setProperty(element, prefix + "-total", items.length);
}
# Splitting.index
Index split elements and add them to a Splitting instance.

@param {HTMLElement} element
@param {string} key 
@param {!Array<!HTMLElement> | !Array<!Array<!HTMLElement>>} items