function wrapSource(source, settings) {
        if (typeof settings.min === "number" || typeof settings.max === "number") {
            var quantifier,
                min = typeof settings.min === "number" ? settings.min : 0,
                max = typeof settings.max === "number" ? settings.max : Infinity;

            if (min === max)
                quantifier = min === 1 ? "" : "{" + min + "}";
            else if (min === 0)
                quantifier = max === 1 ? "?"
                        : max === Infinity ? "*"
                        : "{," + max + "}";
            else if (min === 1)
                quantifier = max === Infinity ? "+" : "{1," + max + "}";
            else quantifier = "{" + min + "," + (max === Infinity ? "" : max) + "}";

            if (quantifier) {
                if ((source.length > 2 || source.length === 2 && source[0] !== "\\") && hasManyBlocks(source))
                    source = "(?:" + source + ")";
                source += quantifier + (settings.lazy ? "?" : "");
            }
        }

        return source;
    }
Adds the eventual quantifier to a chunk of regex source, conveniently
wrapping it in a non-capturing group if it contains more than a block.
@param {string} source
@param {Object} settings  Quantifying settings (min, max and lazy).
@returns {string}         Quantified source