|
565 | 565 | return { length: truncate, location: 'end' }; |
566 | 566 | } |
567 | 567 | else { // object, or undefined/null |
568 | | - return utils_1.defaults(truncate || {}, { |
| 568 | + return (0, utils_1.defaults)(truncate || {}, { |
569 | 569 | length: Number.POSITIVE_INFINITY, |
570 | 570 | location: 'end' |
571 | 571 | }); |
|
608 | 608 | matches = []; |
609 | 609 | // Find all matches within the `textOrHtml` (but not matches that are |
610 | 610 | // already nested within <a>, <style> and <script> tags) |
611 | | - parse_html_1.parseHtml(textOrHtml, { |
| 611 | + (0, parse_html_1.parseHtml)(textOrHtml, { |
612 | 612 | onOpenTag: function (tagName) { |
613 | 613 | if (skipTagNames.indexOf(tagName) >= 0) { |
614 | 614 | skipTagsStackCount++; |
|
623 | 623 | // TODO: Handle HTML entities separately in parseHtml() and |
624 | 624 | // don't emit them as "text" except for &amp; entities |
625 | 625 | var htmlCharacterEntitiesRegex = /(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi; |
626 | | - var textSplit = utils_1.splitAndCapture(text, htmlCharacterEntitiesRegex); |
| 626 | + var textSplit = (0, utils_1.splitAndCapture)(text, htmlCharacterEntitiesRegex); |
627 | 627 | var currentOffset_1 = offset; |
628 | 628 | textSplit.forEach(function (splitText, i) { |
629 | 629 | // even number matches are text, odd numbers are html entities |
|
668 | 668 | Autolinker.prototype.compactMatches = function (matches) { |
669 | 669 | // First, the matches need to be sorted in order of offset |
670 | 670 | matches.sort(function (a, b) { return a.getOffset() - b.getOffset(); }); |
671 | | - for (var i = 0; i < matches.length - 1; i++) { |
| 671 | + var i = 0; |
| 672 | + while (i < matches.length - 1) { |
672 | 673 | var match = matches[i], offset = match.getOffset(), matchedTextLength = match.getMatchedText().length, endIdx = offset + matchedTextLength; |
673 | 674 | if (i + 1 < matches.length) { |
674 | 675 | // Remove subsequent matches that equal offset with current match |
|
680 | 681 | // Remove subsequent matches that overlap with the current match |
681 | 682 | if (matches[i + 1].getOffset() < endIdx) { |
682 | 683 | matches.splice(i + 1, 1); |
| 684 | + continue; |
683 | 685 | } |
684 | 686 | } |
| 687 | + i++; |
685 | 688 | } |
686 | 689 | return matches; |
687 | 690 | }; |
|
705 | 708 | */ |
706 | 709 | Autolinker.prototype.removeUnwantedMatches = function (matches) { |
707 | 710 | if (!this.hashtag) |
708 | | - utils_1.remove(matches, function (match) { return match.getType() === 'hashtag'; }); |
| 711 | + (0, utils_1.remove)(matches, function (match) { return match.getType() === 'hashtag'; }); |
709 | 712 | if (!this.email) |
710 | | - utils_1.remove(matches, function (match) { return match.getType() === 'email'; }); |
| 713 | + (0, utils_1.remove)(matches, function (match) { return match.getType() === 'email'; }); |
711 | 714 | if (!this.phone) |
712 | | - utils_1.remove(matches, function (match) { return match.getType() === 'phone'; }); |
| 715 | + (0, utils_1.remove)(matches, function (match) { return match.getType() === 'phone'; }); |
713 | 716 | if (!this.mention) |
714 | | - utils_1.remove(matches, function (match) { return match.getType() === 'mention'; }); |
| 717 | + (0, utils_1.remove)(matches, function (match) { return match.getType() === 'mention'; }); |
715 | 718 | if (!this.urls.schemeMatches) { |
716 | | - utils_1.remove(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'scheme'; }); |
| 719 | + (0, utils_1.remove)(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'scheme'; }); |
717 | 720 | } |
718 | 721 | if (!this.urls.wwwMatches) { |
719 | | - utils_1.remove(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'www'; }); |
| 722 | + (0, utils_1.remove)(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'www'; }); |
720 | 723 | } |
721 | 724 | if (!this.urls.tldMatches) { |
722 | | - utils_1.remove(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'tld'; }); |
| 725 | + (0, utils_1.remove)(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'tld'; }); |
723 | 726 | } |
724 | 727 | return matches; |
725 | 728 | }; |
|
884 | 887 | * |
885 | 888 | * Ex: 0.25.1 |
886 | 889 | */ |
887 | | - Autolinker.version = '3.14.3'; |
| 890 | + Autolinker.version = '3.15.0'; |
888 | 891 | <span id='Autolinker-AnchorTagBuilder'> /** |
889 | 892 | </span> * For backwards compatibility with Autolinker 1.x, the AnchorTagBuilder |
890 | 893 | * class is provided as a static on the Autolinker class. |
|
0 commit comments