lib/util.js
function indexOfOutside(data, item, index, exclude) {
    var result, positionResult = {start: 0, end: index ? index - 1 : -1};

    do {
        result = data.indexOf(item, positionResult.end + 1);
    } while (result !== -1 && (positionResult = inPosition(result, exclude)));
    return result;
}
function indexOfOutside(data, item, index, exclude) {
    var result, positionResult = {start: 0, end: index ? index - 1 : -1};

    do {
        result = data.indexOf(item, positionResult.end + 1);
    } while (result !== -1 && (positionResult = inPosition(result, exclude)));
    return result;
}
Finds the next index of the item outside of the given positions

@param {String} data The string to search
@param {String} item The item to find
@param {Number=0} index The start index
@param {Array<{start: Number, end: Number}>} exclude The boundaries to exclude
@returns {Number} The found index, or -1 if none found