Improved pivot and String.prototype.repeat

Reduced complexity and unnecessary redundancy of pivot method, made String.prototype.repeat more compliant with ECMA 6 draft.