Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add guard of zero or negative num in String.repeat(num)
so it won't crash on long words.
  • Loading branch information
the-happy-hippo committed May 7, 2014
1 parent b9f56a0 commit 1c33c0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/js/spray-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,5 @@ function pivot(word){
// Let strings repeat themselves,
// because JavaScript isn't as awesome as Python.
String.prototype.repeat = function( num ){
return new Array( num + 1 ).join( this );
return (num<=0) ? "" : new Array( num + 1 ).join( this );
}

0 comments on commit 1c33c0d

Please sign in to comment.