UNPKG
@sendgrid/helpers
Version:
beta (6.0.0-beta.5)
latest (8.0.0)
8.0.0
7.7.0
7.6.2
7.6.0
7.5.0
7.4.6
7.4.3
7.4.2
7.4.0
7.3.0
7.2.6
7.2.4
7.2.3
7.2.0
7.0.1
7.0.0
6.5.5
6.5.3
6.5.1
6.5.0
6.4.0
6.3.0
6.2.1
6.2.0
6.1.5
6.1.3
6.1.2
6.1.1
6.1.0
6.0.0
6.0.0-beta.5
6.0.0-beta.4
6.0.0-beta.3
6.0.0-beta.2
Twilio SendGrid NodeJS internal helpers
sendgrid.com
sendgrid/sendgrid-nodejs
@sendgrid/helpers
/
helpers
/
html-to-plain-text.js
11 lines
(9 loc)
•
241 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
'use strict'
;
/** * Helper to convert an HTML string to a plain text string */
module
.
exports
=
function
convertHTML2PlainString
(
html
) {
let
text = html.
replace
(
/(<([^>]+)>)/g
,
''
); text = text.
replace
(
/\s+/g
,
' '
);
return
text; };