(function(define, undefined) {
'use strict';
define([], function($, _) {
/**
* Replaces all newlines in a string by HTML line breaks.
* @param {String} str The input string.
* @return `String` with '
' instead all newlines (\r\n, \n\r, \n and \r).
* @example
* nl2br("This\r\nis\n\ra\nstring\r")
* Output:
* This
* is
* a
* string
*/
var nl2br = function(str) {
return (str + '').replace(/(\r\n|\n\r|\r|\n)/g, '
');
};
return {
nl2br: nl2br
};
});
}).call(this, define || RequireJS.define);