Sanity check for tokens being an array

Change-Id: Ia4e4071e1469c31e3b320d854500938bb0245f82
This commit is contained in:
Gabriel Wicke 2012-05-24 14:35:58 +02:00
parent 93ce7453f0
commit 3e0e11b1d0

View file

@ -127,6 +127,9 @@ MWParserEnvironment.prototype.setTokenRank = function ( rank, token ) {
// Strip 'end' tokens and trailing newlines // Strip 'end' tokens and trailing newlines
MWParserEnvironment.prototype.stripEOFTkfromTokens = function ( tokens ) { MWParserEnvironment.prototype.stripEOFTkfromTokens = function ( tokens ) {
this.dp( 'stripping end or whitespace tokens' ); this.dp( 'stripping end or whitespace tokens' );
if ( tokens.constructor !== Array ) {
tokens = [ tokens ];
}
if ( ! tokens.length ) { if ( ! tokens.length ) {
return tokens; return tokens;
} }