stringifyPrimitive = function (v) {
    switch (typeof v) {
    case 'string':
        return v;

    case 'boolean':
        return v ? 'true' : 'false';

    case 'number':
        return isFinite(v) ? v : '';

    default:
        return '';
    }
}
Encodes a URI Component, provided so that it could be overridden if
necessary.

@name escape(str)
@param {String} str
@returns {String}
@api public