function(lines) {
							let firstBracketIndex = 0;
							let foundFirstNonWhite = false;
							for (let i = lines.length - 1; i >= 0; i--) {
								const l = lines[i];
								if (!foundFirstNonWhite && (l === SPACE || l === ' ' || !l)) {
									lines.pop();
								} else {
									foundFirstNonWhite = true;
								}

								if (l === '[') {
									firstBracketIndex = i;
									break;
								}
							}

							for (let i = firstBracketIndex + 1; i < lines.length; i++) {
								const l = lines[i];
								if (l === SPACE || l === ' ' ||!l) {
									lines.splice(i, 1);
								} else {
									break;
								}
							}

							return lines;
						}
function(lines) {
							let firstBracketIndex = 0;
							let foundFirstNonWhite = false;
							for (let i = lines.length - 1; i >= 0; i--) {
								const l = lines[i];
								if (!foundFirstNonWhite && (l === SPACE || l === ' ' || !l)) {
									lines.pop();
								} else {
									foundFirstNonWhite = true;
								}

								if (l === '[') {
									firstBracketIndex = i;
									break;
								}
							}

							for (let i = firstBracketIndex + 1; i < lines.length; i++) {
								const l = lines[i];
								if (l === SPACE || l === ' ' ||!l) {
									lines.splice(i, 1);
								} else {
									break;
								}
							}

							return lines;
						}
function ( lines ) { let firstBracketIndex = 0 ; let foundFirstNonWhite = false ; for ( let i = lines . length - 1 ; i >= 0 ; i -- ) { const l = lines [ i ] ; if ( ! foundFirstNonWhite && ( l === SPACE || l === ' ' || ! l ) ) { lines . pop ( ) ; } else { foundFirstNonWhite = true ; } if ( l === '[' ) { firstBracketIndex = i ; break ; } } for ( let i = firstBracketIndex + 1 ; i < lines . length ; i ++ ) { const l = lines [ i ] ; if ( l === SPACE || l === ' ' || ! l ) { lines . splice ( i , 1 ) ; } else { break ; } } return lines ; }
Eg. converts: [ Sign in   ](https://example.com) to: [Sign in](https://example.com)
Eg . converts : [ Sign in ] ( https : // example . com ) to : [ Sign in ] ( https : // example . com )
Remove the last non - white space and whitespace characters from the lines