UNPKG
markup-tools
Version:
latest (2.10.0)
2.10.0
2.9.0
2.7.0
2.6.0
2.5.0
2.4.0
2.3.0
2.2.0
2.1.0
2.0.0
1.0.0
Utility to format markup
github.com/peerquery/markup-tools
peerquery/markup-tools
markup-tools
/
lib
/
formatters
/
links.js
15 lines
(11 loc)
•
302 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'use strict'
;
module
.
exports
=
function
(
text, replacer
) {
var
regex =
/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi
;
var
filler = replacer ||
''
;
try
{
return
String
(text).
replace
(regex, filler); }
catch
(err) {
//console.log(err);
return
''
; } };