File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ declare module "node-email-reply-parser" {
1818 }
1919 type ReplyParserRegular = ( emailContent : string ) => Email ;
2020 type ReplyParserVisibleTextOnly = ( emailContent : string , visibleTextOnly : true ) => string ;
21- const replyParser : ReplyParserRegular & ReplyParserVisibleTextOnly ;
21+ type ReplyParserWithOptions = ( emailContent : string , visibleTextOnly : boolean , options : { signatureRegex ?: RegExp ; quotedLineRegex ?: RegExp ; quoteHeadersRegex ?: RegExp [ ] } ) => Email ;
22+
23+ const replyParser : ReplyParserRegular & ReplyParserVisibleTextOnly & ReplyParserWithOptions ;
2224 export = replyParser ;
2325}
Original file line number Diff line number Diff line change @@ -9,10 +9,14 @@ var Parser = require("./lib/Parser");
99 * Parses the given text into an email
1010 * @param {string } text the email text to parse
1111 * @param {boolean } [visibleTextOnly] if true, the visible text will be returned instead of an Email
12+ * @param {object } [options] the options to pass to the parser
13+ * @param {RegExp } [options.signatureRegex] the regular expression used to match signatures
14+ * @param {RegExp } [options.quotedLineRegex] the regular expression used to match quoted lines
15+ * @param {RegExp[] } [options.quoteHeadersRegex] the regular expressions used to find quoted sections based on the header
1216 * @returns {Email|string } the parsed Email or visible text, depending on the second argument
1317 */
14- function parse ( text , visibleTextOnly ) {
15- var parser = new Parser ( ) ;
18+ function parse ( text , visibleTextOnly , options ) {
19+ var parser = new Parser ( options ?. signatureRegex , options ?. quotedLineRegex , options ?. quoteHeadersRegex ) ;
1620 var email = parser . parse ( text ) ;
1721
1822 if ( visibleTextOnly ) {
You can’t perform that action at this time.
0 commit comments