* Executes a callback on each line and replaces each line with result from the callback. * @param {Object} str Input string. * @param {Object} callback Callback function taking one string argument and returning a string.
(str, callback)
| 700 | * @param {Object} callback Callback function taking one string argument and returning a string. |
| 701 | */ |
| 702 | function eachLine(str, callback) |
| 703 | { |
| 704 | var lines = splitLines(str); |
| 705 | |
| 706 | for (var i = 0; i < lines.length; i++) |
| 707 | lines[i] = callback(lines[i], i); |
| 708 | |
| 709 | return lines.join('\n'); |
| 710 | }; |
| 711 | |
| 712 | /** |
| 713 | * This is a special trim which only removes first and last empty lines |
no test coverage detected