From 28ce606e28f0126cae78ba96895529fd9d19c599 Mon Sep 17 00:00:00 2001 From: Alex Corvi Date: Mon, 27 Feb 2017 00:18:50 +0300 Subject: [PATCH] compiled to ES5 --- dist-browser/anchorme.js | 20 ++++++++++---------- dist-browser/anchorme.min.js | 2 +- dist-node/index.js | 14 +++++++------- dist-node/separate/fix.js | 6 +++--- dist-node/separate/separate.js | 2 +- dist-node/tests/email.js | 8 ++++---- dist-node/tests/hasprotocol.js | 12 ++++++------ dist-node/tests/ip.js | 4 ++-- dist-node/tests/url.js | 8 ++++---- dist-node/transform/identify.js | 12 ++++++------ dist-node/transform/transform.js | 16 ++++++++-------- 11 files changed, 52 insertions(+), 52 deletions(-) diff --git a/dist-browser/anchorme.js b/dist-browser/anchorme.js index a6e2a98..fea7e06 100644 --- a/dist-browser/anchorme.js +++ b/dist-browser/anchorme.js @@ -266,17 +266,17 @@ var hasprotocol = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); function default_1(str) { str = str.toLowerCase(); - if (str.startsWith("http://")) + if (str.indexOf("http://") === 0) { return "http://"; } - else if (str.startsWith("https://")) + else if (str.indexOf("https://") === 0) { return "https://"; } - else if (str.startsWith("ftp://")) + else if (str.indexOf("ftp://") === 0) { return "ftp://"; } - else if (str.startsWith("ftps://")) + else if (str.indexOf("ftps://") === 0) { return "ftps://"; } - else if (str.startsWith("file:///")) + else if (str.indexOf("file:///") === 0) { return "file:///"; } - else if (str.startsWith("mailto:")) + else if (str.indexOf("mailto:") === 0) { return "mailto:"; } else { return false; } @@ -395,18 +395,18 @@ function url2tag(fragment, options) { } if (options.attributes === undefined) { options.attributes = []; } - return ("" + original + ""); + { return " " + attribute.name + "=\"" + attribute.value + "\" "; } + }).join("") + ">" + original + ""; } }); diff --git a/dist-browser/anchorme.min.js b/dist-browser/anchorme.min.js index 5c8a82b..1a17db4 100644 --- a/dist-browser/anchorme.min.js +++ b/dist-browser/anchorme.min.js @@ -1 +1 @@ -!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):e.anchorme=a()}(this,function(){"use strict";function e(e){return e&&e.__esModule?e.default:e}function a(e,a){return a={exports:{}},e(a,a.exports),a.exports}var t=a(function(e,a){function t(e){return e||(e={attributes:[],ips:!0,emails:!0,urls:!0,files:!0,truncate:1/0,defaultProtocol:"http://",list:!1}),"object"!=typeof e.attributes&&(e.attributes=[]),"boolean"!=typeof e.ips&&(e.ips=!0),"boolean"!=typeof e.emails&&(e.emails=!0),"boolean"!=typeof e.urls&&(e.urls=!0),"boolean"!=typeof e.files&&(e.files=!0),"boolean"!=typeof e.list&&(e.list=!1),"string"!=typeof e.defaultProtocol&&"function"!=typeof e.defaultProtocol&&(e.defaultProtocol="http://"),"number"==typeof e.truncate||"object"==typeof e.truncate&&null!==e.truncate||(e.truncate=1/0),e}function o(e){return!isNaN(Number(e))&&!(Number(e)>65535)}Object.defineProperty(a,"__esModule",{value:!0}),a.defaultOptions=t,a.isPort=o}),o=a(function(e,a){Object.defineProperty(a,"__esModule",{value:!0}),a.tlds=["com","net","org","edu","gov","uk","ca","de","jp","fr","au","us","ru","ch","it","nl","se","no","es","io","aaa","aarp","abarth","abb","abbott","abbvie","abc","able","abogado","abudhabi","ac","academy","accenture","accountant","accountants","aco","active","actor","ad","adac","ads","adult","ae","aeg","aero","aetna","af","afamilycompany","afl","ag","agakhan","agency","ai","aig","aigo","airbus","airforce","airtel","akdn","al","alfaromeo","alibaba","alipay","allfinanz","allstate","ally","alsace","alstom","am","americanexpress","americanfamily","amex","amfam","amica","amsterdam","analytics","android","anquan","anz","ao","apartments","app","apple","aq","aquarelle","ar","aramco","archi","army","arpa","art","arte","as","asda","asia","associates","at","athleta","attorney","au","auction","audi","audible","audio","auspost","author","auto","autos","avianca","aw","aws","ax","axa","az","azure","ba","baby","baidu","banamex","bananarepublic","band","bank","bar","barcelona","barclaycard","barclays","barefoot","bargains","bauhaus","bayern","bb","bbc","bbt","bbva","bcg","bcn","bd","be","beats","beauty","beer","bentley","berlin","best","bestbuy","bet","bf","bg","bh","bharti","bi","bible","bid","bike","bing","bingo","bio","biz","bj","black","blackfriday","blanco","blockbuster","blog","bloomberg","blue","bm","bms","bmw","bn","bnl","bnpparibas","bo","boats","boehringer","bofa","bom","bond","boo","book","booking","boots","bosch","bostik","bot","boutique","br","bradesco","bridgestone","broadway","broker","brother","brussels","bs","bt","budapest","bugatti","build","builders","business","buy","buzz","bv","bw","by","bz","bzh","ca","cab","cafe","cal","call","calvinklein","cam","camera","camp","cancerresearch","canon","capetown","capital","capitalone","car","caravan","cards","care","career","careers","cars","cartier","casa","cash","casino","cat","catering","cba","cbn","cbre","cbs","cc","cd","ceb","center","ceo","cern","cf","cfa","cfd","cg","ch","chanel","channel","chase","chat","cheap","chintai","chloe","christmas","chrome","chrysler","church","ci","cipriani","circle","cisco","citadel","citi","citic","city","cityeats","ck","cl","claims","cleaning","click","clinic","clinique","clothing","cloud","club","clubmed","cm","cn","co","coach","codes","coffee","college","cologne","comcast","commbank","community","company","compare","computer","comsec","condos","construction","consulting","contact","contractors","cooking","cookingchannel","cool","coop","corsica","country","coupon","coupons","courses","cr","credit","creditcard","creditunion","cricket","crown","crs","cruises","csc","cu","cuisinella","cv","cw","cx","cy","cymru","cyou","cz","dabur","dad","dance","date","dating","datsun","day","dclk","dds","de","deal","dealer","deals","degree","delivery","dell","deloitte","delta","democrat","dental","dentist","desi","design","dev","dhl","diamonds","diet","digital","direct","directory","discount","discover","dish","diy","dj","dk","dm","dnp","do","docs","doctor","dodge","dog","doha","domains","dot","download","drive","dtv","dubai","duck","dunlop","duns","dupont","durban","dvag","dvr","dz","earth","eat","ec","eco","edeka","edu","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","epost","epson","equipment","er","ericsson","erni","es","esq","estate","esurance","et","eu","eurovision","eus","events","everbank","exchange","expert","exposed","express","extraspace","fage","fail","fairwinds","faith","family","fan","fans","farm","farmers","fashion","fast","fedex","feedback","ferrari","ferrero","fi","fiat","fidelity","fido","film","final","finance","financial","fire","firestone","firmdale","fish","fishing","fit","fitness","fj","fk","flickr","flights","flir","florist","flowers","fly","fm","fo","foo","foodnetwork","football","ford","forex","forsale","forum","foundation","fox","fr","fresenius","frl","frogans","frontdoor","frontier","ftr","fujitsu","fujixerox","fund","furniture","futbol","fyi","ga","gal","gallery","gallo","gallup","game","games","gap","garden","gb","gbiz","gd","gdn","ge","gea","gent","genting","george","gf","gg","ggee","gh","gi","gift","gifts","gives","giving","gl","glade","glass","gle","global","globo","gm","gmail","gmbh","gmo","gmx","gn","godaddy","gold","goldpoint","golf","goo","goodhands","goodyear","goog","google","gop","got","gov","gp","gq","gr","grainger","graphics","gratis","green","gripe","group","gs","gt","gu","guardian","gucci","guge","guide","guitars","guru","gw","gy","hamburg","hangout","haus","hbo","hdfc","hdfcbank","health","healthcare","help","helsinki","here","hermes","hgtv","hiphop","hisamitsu","hitachi","hiv","hk","hkt","hm","hn","hockey","holdings","holiday","homedepot","homegoods","homes","homesense","honda","honeywell","horse","host","hosting","hot","hoteles","hotmail","house","how","hr","hsbc","ht","htc","hu","hughes","hyatt","hyundai","ibm","icbc","ice","icu","id","ie","ieee","ifm","iinet","ikano","il","im","imamat","imdb","immo","immobilien","in","industries","infiniti","info","ing","ink","institute","insurance","insure","int","intel","international","intuit","investments","io","ipiranga","iq","ir","irish","is","iselect","ismaili","ist","istanbul","it","itau","itv","iwc","jaguar","java","jcb","jcp","je","jeep","jetzt","jewelry","jlc","jll","jm","jmp","jnj","jo","jobs","joburg","jot","joy","jp","jpmorgan","jprs","juegos","juniper","kaufen","kddi","ke","kerryhotels","kerrylogistics","kerryproperties","kfh","kg","kh","ki","kia","kim","kinder","kindle","kitchen","kiwi","km","kn","koeln","komatsu","kosher","kp","kpmg","kpn","kr","krd","kred","kuokgroup","kw","ky","kyoto","kz","la","lacaixa","ladbrokes","lamborghini","lamer","lancaster","lancia","lancome","land","landrover","lanxess","lasalle","lat","latino","latrobe","law","lawyer","lb","lc","lds","lease","leclerc","lefrak","legal","lego","lexus","lgbt","li","liaison","lidl","life","lifeinsurance","lifestyle","lighting","like","lilly","limited","limo","lincoln","linde","link","lipsy","live","living","lixil","lk","loan","loans","locker","locus","loft","lol","london","lotte","lotto","love","lpl","lplfinancial","lr","ls","lt","ltd","ltda","lu","lundbeck","lupin","luxe","luxury","lv","ly","ma","macys","madrid","maif","maison","makeup","man","management","mango","market","marketing","markets","marriott","marshalls","maserati","mattel","mba","mc","mcd","mcdonalds","mckinsey","md","me","med","media","meet","melbourne","meme","memorial","men","menu","meo","metlife","mg","mh","miami","microsoft","mil","mini","mint","mit","mitsubishi","mk","ml","mlb","mls","mm","mma","mn","mo","mobi","mobily","moda","moe","moi","mom","monash","money","monster","montblanc","mopar","mormon","mortgage","moscow","motorcycles","mov","movie","movistar","mp","mq","mr","ms","msd","mt","mtn","mtpc","mtr","mu","museum","mutual","mutuelle","mv","mw","mx","my","mz","na","nab","nadex","nagoya","name","nationwide","natura","navy","nba","nc","ne","nec","netbank","netflix","network","neustar","new","news","next","nextdirect","nexus","nf","nfl","ng","ngo","nhk","ni","nico","nike","nikon","ninja","nissan","nissay","nl","no","nokia","northwesternmutual","norton","now","nowruz","nowtv","np","nr","nra","nrw","ntt","nu","nyc","nz","obi","observer","off","office","okinawa","olayan","olayangroup","oldnavy","ollo","om","omega","one","ong","onl","online","onyourside","ooo","open","oracle","orange","org","organic","orientexpress","origins","osaka","otsuka","ott","ovh","pa","page","pamperedchef","panasonic","panerai","paris","pars","partners","parts","party","passagens","pay","pccw","pe","pet","pf","pfizer","pg","ph","pharmacy","philips","photo","photography","photos","physio","piaget","pics","pictet","pictures","pid","pin","ping","pink","pioneer","pizza","pk","pl","place","play","playstation","plumbing","plus","pm","pn","pnc","pohl","poker","politie","porn","post","pr","pramerica","praxi","press","prime","pro","prod","productions","prof","progressive","promo","properties","property","protection","pru","prudential","ps","pt","pub","pw","pwc","py","qa","qpon","quebec","quest","qvc","racing","raid","re","read","realestate","realtor","realty","recipes","red","redstone","redumbrella","rehab","reise","reisen","reit","ren","rent","rentals","repair","report","republican","rest","restaurant","review","reviews","rexroth","rich","richardli","ricoh","rightathome","rio","rip","ro","rocher","rocks","rodeo","rogers","room","rs","rsvp","ru","ruhr","run","rw","rwe","ryukyu","sa","saarland","safe","safety","sakura","sale","salon","samsclub","samsung","sandvik","sandvikcoromant","sanofi","sap","sapo","sarl","sas","save","saxo","sb","sbi","sbs","sc","sca","scb","schaeffler","schmidt","scholarships","school","schule","schwarz","science","scjohnson","scor","scot","sd","se","seat","secure","security","seek","select","sener","services","ses","seven","sew","sex","sexy","sfr","sg","sh","shangrila","sharp","shaw","shell","shia","shiksha","shoes","shop","shopping","shouji","show","showtime","shriram","si","silk","sina","singles","site","sj","sk","ski","skin","sky","skype","sl","sling","sm","smart","smile","sn","sncf","so","soccer","social","softbank","software","sohu","solar","solutions","song","sony","soy","space","spiegel","spot","spreadbetting","sr","srl","srt","st","stada","staples","star","starhub","statebank","statefarm","statoil","stc","stcgroup","stockholm","storage","store","stream","studio","study","style","su","sucks","supplies","supply","support","surf","surgery","suzuki","sv","swatch","swiftcover","swiss","sx","sy","sydney","symantec","systems","sz","tab","taipei","talk","taobao","target","tatamotors","tatar","tattoo","tax","taxi","tc","tci","td","tdk","team","tech","technology","tel","telecity","telefonica","temasek","tennis","teva","tf","tg","th","thd","theater","theatre","tiaa","tickets","tienda","tiffany","tips","tires","tirol","tj","tjmaxx","tjx","tk","tkmaxx","tl","tm","tmall","tn","to","today","tokyo","tools","top","toray","toshiba","total","tours","town","toyota","toys","tr","trade","trading","training","travel","travelchannel","travelers","travelersinsurance","trust","trv","tt","tube","tui","tunes","tushu","tv","tvs","tw","tz","ua","ubank","ubs","uconnect","ug","uk","unicom","university","uno","uol","ups","us","uy","uz","va","vacations","vana","vanguard","vc","ve","vegas","ventures","verisign","versicherung","vet","vg","vi","viajes","video","vig","viking","villas","vin","vip","virgin","visa","vision","vista","vistaprint","viva","vivo","vlaanderen","vn","vodka","volkswagen","vote","voting","voto","voyage","vu","vuelos","wales","walmart","walter","wang","wanggou","warman","watch","watches","weather","weatherchannel","webcam","weber","website","wed","wedding","weibo","weir","wf","whoswho","wien","wiki","williamhill","win","windows","wine","winners","wme","wolterskluwer","woodside","work","works","world","wow","ws","wtc","wtf","xbox","xerox","xfinity","xihuan","xin","xperia","xxx","xyz","yachts","yahoo","yamaxun","yandex","ye","yodobashi","yoga","yokohama","you","youtube","yt","yun","za","zappos","zara","zero","zip","zippo","zm","zone","zuerich","zw"],a.htmlAttrs=["src=","data=","href=","cite=","formaction=","icon=","manifest=","poster=","codebase=","background=","profile=","usemap="]}),r=a(function(e,a){function t(e){var a=e.match(i);if(null===a)return!1;for(var t=n.length-1;t>=0;t--)if(n[t].test(e))return!1;var o=a[2];return!!o&&r.tlds.indexOf(o)!==-1}Object.defineProperty(a,"__esModule",{value:!0});var r=o,i=/^[a-z0-9!#$%&'*+\-\/=?^_`{|}~.]+@([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?$/i,n=[/^[!#$%&'*+\-\/=?^_`{|}~.]/,/[.]{2,}[a-z0-9!#$%&'*+\-\/=?^_`{|}~.]+@/i,/\.@/];a.default=t}),i=a(function(e,a){function o(e){if(!i.test(e))return!1;var a=e.split("."),t=Number(a[0]);if(isNaN(t)||t>255||t<0)return!1;var o=Number(a[1]);if(isNaN(o)||o>255||o<0)return!1;var n=Number(a[2]);if(isNaN(n)||n>255||n<0)return!1;var s=Number((a[3].match(/^\d+/)||[])[0]);if(isNaN(s)||s>255||s<0)return!1;var l=(a[3].match(/(^\d+)(:)(\d+)/)||[])[3];return!(l&&!r.isPort(l))}Object.defineProperty(a,"__esModule",{value:!0});var r=t,i=/^(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?(\/.*)?$/;a.default=o}),n=a(function(e,a){function r(e){var a=e.match(s);return null!==a&&("string"==typeof a[3]&&(n.tlds.indexOf(a[3].toLowerCase())!==-1&&!(a[5]&&!i.isPort(a[5]))))}Object.defineProperty(a,"__esModule",{value:!0});var i=t,n=o,s=/^(https?:\/\/|ftps?:\/\/)?([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?(:(\d{1,5}))?(\/([a-z0-9\-._~:\/\?#\[\]@!$&'\(\)\*\+,;=%]+)?)?$/i;a.default=r}),s=a(function(e,a){function t(e,a,o){return e.forEach(function(r,i){!(r.indexOf(".")>-1)||e[i-1]===a&&e[i+1]===o||e[i+1]!==a&&e[i+1]!==o||(e[i]=e[i]+e[i+1],"string"==typeof e[i+2]&&(e[i]=e[i]+e[i+2]),"string"==typeof e[i+3]&&(e[i]=e[i]+e[i+3]),"string"==typeof e[i+4]&&(e[i]=e[i]+e[i+4]),e.splice(i+1,4),t(e,a,o))}),e}function o(e){return e=t(e,"(",")"),e=t(e,"[","]"),e=t(e,'"','"'),e=t(e,"'","'")}Object.defineProperty(a,"__esModule",{value:!0}),a.fixSeparators=t,a.default=o}),l=a(function(e,a){function t(e){var a=e.replace(/([\s\(\)\[\]<>"'])/g,"\0$1\0").replace(/([?;:,.!]+)(?=(\0|$|\s))/g,"\0$1\0").split("\0"),t=r.default(a);return t}function o(e){return e.join("")}Object.defineProperty(a,"__esModule",{value:!0});var r=s;a.separate=t,a.deSeparate=o}),c=a(function(e,a){function t(e){return e=e.toLowerCase(),e.startsWith("http://")?"http://":e.startsWith("https://")?"https://":e.startsWith("ftp://")?"ftp://":e.startsWith("ftps://")?"ftps://":e.startsWith("file:///")?"file:///":!!e.startsWith("mailto:")&&"mailto:"}Object.defineProperty(a,"__esModule",{value:!0}),a.default=t}),u=a(function(e,a){function t(e,a){return e.map(function(t,o){var r=encodeURI(t);if(r.indexOf(".")<1&&!l.default(r))return t;var i=null,n=l.default(r)||"";if(a.files&&"file:///"===n&&r.substr(n.length).split(/\/|\\/).length-1?i={reason:"file",protocol:n,raw:t,encoded:r}:n&&(r=r.substr(n.length)),!i&&a.urls&&f.default(r)&&(i={reason:"url",protocol:n?n:"function"==typeof a.defaultProtocol?a.defaultProtocol(t):a.defaultProtocol,raw:t,encoded:r}),!i&&a.emails&&u.default(r)&&(i={reason:"email",protocol:"mailto:",raw:t,encoded:r}),!i&&a.ips&&d.default(r)&&(i={reason:"ip",protocol:n?n:"function"==typeof a.defaultProtocol?a.defaultProtocol(t):a.defaultProtocol,raw:t,encoded:r}),i){return"'"!==e[o-1]&&'"'!==e[o-1]||!~s.htmlAttrs.indexOf(e[o-2])?i:t}return t})}Object.defineProperty(a,"__esModule",{value:!0});var s=o,l=c,u=r,d=i,f=n;a.default=t}),d=a(function(e,a){function t(e,a){var t=r.separate(e),s=n.default(t,a);if(a.list){for(var l=[],c=0;ca.truncate&&(o=o.substring(0,a.truncate)+"..."),"object"==typeof a.truncate&&o.length>a.truncate[0]+a.truncate[1]&&(o=o.substr(0,a.truncate[0])+"..."+o.substr(o.length-a.truncate[1])),void 0===a.attributes&&(a.attributes=[]),'"+o+""}Object.defineProperty(a,"__esModule",{value:!0});var r=l,i=l,n=u;a.default=t}),f=a(function(e,a){Object.defineProperty(a,"__esModule",{value:!0});var o=t,s=r,l=i,u=n,f=d,p=c,m=function(e,a){a=o.defaultOptions(a);var t=f.default(e,a);return t};m.validate={ip:l.default,url:function(e){var a=p.default(e)||"";return e=e.substr(a.length),e=encodeURI(e),u.default(e)},email:s.default},a.default=m}),p=e(f);return p}); \ No newline at end of file +!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):e.anchorme=a()}(this,function(){"use strict";function e(e){return e&&e.__esModule?e.default:e}function a(e,a){return a={exports:{}},e(a,a.exports),a.exports}var t=a(function(e,a){function t(e){return e||(e={attributes:[],ips:!0,emails:!0,urls:!0,files:!0,truncate:1/0,defaultProtocol:"http://",list:!1}),"object"!=typeof e.attributes&&(e.attributes=[]),"boolean"!=typeof e.ips&&(e.ips=!0),"boolean"!=typeof e.emails&&(e.emails=!0),"boolean"!=typeof e.urls&&(e.urls=!0),"boolean"!=typeof e.files&&(e.files=!0),"boolean"!=typeof e.list&&(e.list=!1),"string"!=typeof e.defaultProtocol&&"function"!=typeof e.defaultProtocol&&(e.defaultProtocol="http://"),"number"==typeof e.truncate||"object"==typeof e.truncate&&null!==e.truncate||(e.truncate=1/0),e}function o(e){return!isNaN(Number(e))&&!(Number(e)>65535)}Object.defineProperty(a,"__esModule",{value:!0}),a.defaultOptions=t,a.isPort=o}),o=a(function(e,a){Object.defineProperty(a,"__esModule",{value:!0}),a.tlds=["com","net","org","edu","gov","uk","ca","de","jp","fr","au","us","ru","ch","it","nl","se","no","es","io","aaa","aarp","abarth","abb","abbott","abbvie","abc","able","abogado","abudhabi","ac","academy","accenture","accountant","accountants","aco","active","actor","ad","adac","ads","adult","ae","aeg","aero","aetna","af","afamilycompany","afl","ag","agakhan","agency","ai","aig","aigo","airbus","airforce","airtel","akdn","al","alfaromeo","alibaba","alipay","allfinanz","allstate","ally","alsace","alstom","am","americanexpress","americanfamily","amex","amfam","amica","amsterdam","analytics","android","anquan","anz","ao","apartments","app","apple","aq","aquarelle","ar","aramco","archi","army","arpa","art","arte","as","asda","asia","associates","at","athleta","attorney","au","auction","audi","audible","audio","auspost","author","auto","autos","avianca","aw","aws","ax","axa","az","azure","ba","baby","baidu","banamex","bananarepublic","band","bank","bar","barcelona","barclaycard","barclays","barefoot","bargains","bauhaus","bayern","bb","bbc","bbt","bbva","bcg","bcn","bd","be","beats","beauty","beer","bentley","berlin","best","bestbuy","bet","bf","bg","bh","bharti","bi","bible","bid","bike","bing","bingo","bio","biz","bj","black","blackfriday","blanco","blockbuster","blog","bloomberg","blue","bm","bms","bmw","bn","bnl","bnpparibas","bo","boats","boehringer","bofa","bom","bond","boo","book","booking","boots","bosch","bostik","bot","boutique","br","bradesco","bridgestone","broadway","broker","brother","brussels","bs","bt","budapest","bugatti","build","builders","business","buy","buzz","bv","bw","by","bz","bzh","ca","cab","cafe","cal","call","calvinklein","cam","camera","camp","cancerresearch","canon","capetown","capital","capitalone","car","caravan","cards","care","career","careers","cars","cartier","casa","cash","casino","cat","catering","cba","cbn","cbre","cbs","cc","cd","ceb","center","ceo","cern","cf","cfa","cfd","cg","ch","chanel","channel","chase","chat","cheap","chintai","chloe","christmas","chrome","chrysler","church","ci","cipriani","circle","cisco","citadel","citi","citic","city","cityeats","ck","cl","claims","cleaning","click","clinic","clinique","clothing","cloud","club","clubmed","cm","cn","co","coach","codes","coffee","college","cologne","comcast","commbank","community","company","compare","computer","comsec","condos","construction","consulting","contact","contractors","cooking","cookingchannel","cool","coop","corsica","country","coupon","coupons","courses","cr","credit","creditcard","creditunion","cricket","crown","crs","cruises","csc","cu","cuisinella","cv","cw","cx","cy","cymru","cyou","cz","dabur","dad","dance","date","dating","datsun","day","dclk","dds","de","deal","dealer","deals","degree","delivery","dell","deloitte","delta","democrat","dental","dentist","desi","design","dev","dhl","diamonds","diet","digital","direct","directory","discount","discover","dish","diy","dj","dk","dm","dnp","do","docs","doctor","dodge","dog","doha","domains","dot","download","drive","dtv","dubai","duck","dunlop","duns","dupont","durban","dvag","dvr","dz","earth","eat","ec","eco","edeka","edu","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","epost","epson","equipment","er","ericsson","erni","es","esq","estate","esurance","et","eu","eurovision","eus","events","everbank","exchange","expert","exposed","express","extraspace","fage","fail","fairwinds","faith","family","fan","fans","farm","farmers","fashion","fast","fedex","feedback","ferrari","ferrero","fi","fiat","fidelity","fido","film","final","finance","financial","fire","firestone","firmdale","fish","fishing","fit","fitness","fj","fk","flickr","flights","flir","florist","flowers","fly","fm","fo","foo","foodnetwork","football","ford","forex","forsale","forum","foundation","fox","fr","fresenius","frl","frogans","frontdoor","frontier","ftr","fujitsu","fujixerox","fund","furniture","futbol","fyi","ga","gal","gallery","gallo","gallup","game","games","gap","garden","gb","gbiz","gd","gdn","ge","gea","gent","genting","george","gf","gg","ggee","gh","gi","gift","gifts","gives","giving","gl","glade","glass","gle","global","globo","gm","gmail","gmbh","gmo","gmx","gn","godaddy","gold","goldpoint","golf","goo","goodhands","goodyear","goog","google","gop","got","gov","gp","gq","gr","grainger","graphics","gratis","green","gripe","group","gs","gt","gu","guardian","gucci","guge","guide","guitars","guru","gw","gy","hamburg","hangout","haus","hbo","hdfc","hdfcbank","health","healthcare","help","helsinki","here","hermes","hgtv","hiphop","hisamitsu","hitachi","hiv","hk","hkt","hm","hn","hockey","holdings","holiday","homedepot","homegoods","homes","homesense","honda","honeywell","horse","host","hosting","hot","hoteles","hotmail","house","how","hr","hsbc","ht","htc","hu","hughes","hyatt","hyundai","ibm","icbc","ice","icu","id","ie","ieee","ifm","iinet","ikano","il","im","imamat","imdb","immo","immobilien","in","industries","infiniti","info","ing","ink","institute","insurance","insure","int","intel","international","intuit","investments","io","ipiranga","iq","ir","irish","is","iselect","ismaili","ist","istanbul","it","itau","itv","iwc","jaguar","java","jcb","jcp","je","jeep","jetzt","jewelry","jlc","jll","jm","jmp","jnj","jo","jobs","joburg","jot","joy","jp","jpmorgan","jprs","juegos","juniper","kaufen","kddi","ke","kerryhotels","kerrylogistics","kerryproperties","kfh","kg","kh","ki","kia","kim","kinder","kindle","kitchen","kiwi","km","kn","koeln","komatsu","kosher","kp","kpmg","kpn","kr","krd","kred","kuokgroup","kw","ky","kyoto","kz","la","lacaixa","ladbrokes","lamborghini","lamer","lancaster","lancia","lancome","land","landrover","lanxess","lasalle","lat","latino","latrobe","law","lawyer","lb","lc","lds","lease","leclerc","lefrak","legal","lego","lexus","lgbt","li","liaison","lidl","life","lifeinsurance","lifestyle","lighting","like","lilly","limited","limo","lincoln","linde","link","lipsy","live","living","lixil","lk","loan","loans","locker","locus","loft","lol","london","lotte","lotto","love","lpl","lplfinancial","lr","ls","lt","ltd","ltda","lu","lundbeck","lupin","luxe","luxury","lv","ly","ma","macys","madrid","maif","maison","makeup","man","management","mango","market","marketing","markets","marriott","marshalls","maserati","mattel","mba","mc","mcd","mcdonalds","mckinsey","md","me","med","media","meet","melbourne","meme","memorial","men","menu","meo","metlife","mg","mh","miami","microsoft","mil","mini","mint","mit","mitsubishi","mk","ml","mlb","mls","mm","mma","mn","mo","mobi","mobily","moda","moe","moi","mom","monash","money","monster","montblanc","mopar","mormon","mortgage","moscow","motorcycles","mov","movie","movistar","mp","mq","mr","ms","msd","mt","mtn","mtpc","mtr","mu","museum","mutual","mutuelle","mv","mw","mx","my","mz","na","nab","nadex","nagoya","name","nationwide","natura","navy","nba","nc","ne","nec","netbank","netflix","network","neustar","new","news","next","nextdirect","nexus","nf","nfl","ng","ngo","nhk","ni","nico","nike","nikon","ninja","nissan","nissay","nl","no","nokia","northwesternmutual","norton","now","nowruz","nowtv","np","nr","nra","nrw","ntt","nu","nyc","nz","obi","observer","off","office","okinawa","olayan","olayangroup","oldnavy","ollo","om","omega","one","ong","onl","online","onyourside","ooo","open","oracle","orange","org","organic","orientexpress","origins","osaka","otsuka","ott","ovh","pa","page","pamperedchef","panasonic","panerai","paris","pars","partners","parts","party","passagens","pay","pccw","pe","pet","pf","pfizer","pg","ph","pharmacy","philips","photo","photography","photos","physio","piaget","pics","pictet","pictures","pid","pin","ping","pink","pioneer","pizza","pk","pl","place","play","playstation","plumbing","plus","pm","pn","pnc","pohl","poker","politie","porn","post","pr","pramerica","praxi","press","prime","pro","prod","productions","prof","progressive","promo","properties","property","protection","pru","prudential","ps","pt","pub","pw","pwc","py","qa","qpon","quebec","quest","qvc","racing","raid","re","read","realestate","realtor","realty","recipes","red","redstone","redumbrella","rehab","reise","reisen","reit","ren","rent","rentals","repair","report","republican","rest","restaurant","review","reviews","rexroth","rich","richardli","ricoh","rightathome","rio","rip","ro","rocher","rocks","rodeo","rogers","room","rs","rsvp","ru","ruhr","run","rw","rwe","ryukyu","sa","saarland","safe","safety","sakura","sale","salon","samsclub","samsung","sandvik","sandvikcoromant","sanofi","sap","sapo","sarl","sas","save","saxo","sb","sbi","sbs","sc","sca","scb","schaeffler","schmidt","scholarships","school","schule","schwarz","science","scjohnson","scor","scot","sd","se","seat","secure","security","seek","select","sener","services","ses","seven","sew","sex","sexy","sfr","sg","sh","shangrila","sharp","shaw","shell","shia","shiksha","shoes","shop","shopping","shouji","show","showtime","shriram","si","silk","sina","singles","site","sj","sk","ski","skin","sky","skype","sl","sling","sm","smart","smile","sn","sncf","so","soccer","social","softbank","software","sohu","solar","solutions","song","sony","soy","space","spiegel","spot","spreadbetting","sr","srl","srt","st","stada","staples","star","starhub","statebank","statefarm","statoil","stc","stcgroup","stockholm","storage","store","stream","studio","study","style","su","sucks","supplies","supply","support","surf","surgery","suzuki","sv","swatch","swiftcover","swiss","sx","sy","sydney","symantec","systems","sz","tab","taipei","talk","taobao","target","tatamotors","tatar","tattoo","tax","taxi","tc","tci","td","tdk","team","tech","technology","tel","telecity","telefonica","temasek","tennis","teva","tf","tg","th","thd","theater","theatre","tiaa","tickets","tienda","tiffany","tips","tires","tirol","tj","tjmaxx","tjx","tk","tkmaxx","tl","tm","tmall","tn","to","today","tokyo","tools","top","toray","toshiba","total","tours","town","toyota","toys","tr","trade","trading","training","travel","travelchannel","travelers","travelersinsurance","trust","trv","tt","tube","tui","tunes","tushu","tv","tvs","tw","tz","ua","ubank","ubs","uconnect","ug","uk","unicom","university","uno","uol","ups","us","uy","uz","va","vacations","vana","vanguard","vc","ve","vegas","ventures","verisign","versicherung","vet","vg","vi","viajes","video","vig","viking","villas","vin","vip","virgin","visa","vision","vista","vistaprint","viva","vivo","vlaanderen","vn","vodka","volkswagen","vote","voting","voto","voyage","vu","vuelos","wales","walmart","walter","wang","wanggou","warman","watch","watches","weather","weatherchannel","webcam","weber","website","wed","wedding","weibo","weir","wf","whoswho","wien","wiki","williamhill","win","windows","wine","winners","wme","wolterskluwer","woodside","work","works","world","wow","ws","wtc","wtf","xbox","xerox","xfinity","xihuan","xin","xperia","xxx","xyz","yachts","yahoo","yamaxun","yandex","ye","yodobashi","yoga","yokohama","you","youtube","yt","yun","za","zappos","zara","zero","zip","zippo","zm","zone","zuerich","zw"],a.htmlAttrs=["src=","data=","href=","cite=","formaction=","icon=","manifest=","poster=","codebase=","background=","profile=","usemap="]}),r=a(function(e,a){function t(e){var a=e.match(i);if(null===a)return!1;for(var t=n.length-1;t>=0;t--)if(n[t].test(e))return!1;var o=a[2];return!!o&&r.tlds.indexOf(o)!==-1}Object.defineProperty(a,"__esModule",{value:!0});var r=o,i=/^[a-z0-9!#$%&'*+\-\/=?^_`{|}~.]+@([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?$/i,n=[/^[!#$%&'*+\-\/=?^_`{|}~.]/,/[.]{2,}[a-z0-9!#$%&'*+\-\/=?^_`{|}~.]+@/i,/\.@/];a.default=t}),i=a(function(e,a){function o(e){if(!i.test(e))return!1;var a=e.split("."),t=Number(a[0]);if(isNaN(t)||t>255||t<0)return!1;var o=Number(a[1]);if(isNaN(o)||o>255||o<0)return!1;var n=Number(a[2]);if(isNaN(n)||n>255||n<0)return!1;var s=Number((a[3].match(/^\d+/)||[])[0]);if(isNaN(s)||s>255||s<0)return!1;var l=(a[3].match(/(^\d+)(:)(\d+)/)||[])[3];return!(l&&!r.isPort(l))}Object.defineProperty(a,"__esModule",{value:!0});var r=t,i=/^(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?(\/.*)?$/;a.default=o}),n=a(function(e,a){function r(e){var a=e.match(s);return null!==a&&("string"==typeof a[3]&&(n.tlds.indexOf(a[3].toLowerCase())!==-1&&!(a[5]&&!i.isPort(a[5]))))}Object.defineProperty(a,"__esModule",{value:!0});var i=t,n=o,s=/^(https?:\/\/|ftps?:\/\/)?([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?(:(\d{1,5}))?(\/([a-z0-9\-._~:\/\?#\[\]@!$&'\(\)\*\+,;=%]+)?)?$/i;a.default=r}),s=a(function(e,a){function t(e,a,o){return e.forEach(function(r,i){!(r.indexOf(".")>-1)||e[i-1]===a&&e[i+1]===o||e[i+1]!==a&&e[i+1]!==o||(e[i]=e[i]+e[i+1],"string"==typeof e[i+2]&&(e[i]=e[i]+e[i+2]),"string"==typeof e[i+3]&&(e[i]=e[i]+e[i+3]),"string"==typeof e[i+4]&&(e[i]=e[i]+e[i+4]),e.splice(i+1,4),t(e,a,o))}),e}function o(e){return e=t(e,"(",")"),e=t(e,"[","]"),e=t(e,'"','"'),e=t(e,"'","'")}Object.defineProperty(a,"__esModule",{value:!0}),a.fixSeparators=t,a.default=o}),l=a(function(e,a){function t(e){var a=e.replace(/([\s\(\)\[\]<>"'])/g,"\0$1\0").replace(/([?;:,.!]+)(?=(\0|$|\s))/g,"\0$1\0").split("\0"),t=r.default(a);return t}function o(e){return e.join("")}Object.defineProperty(a,"__esModule",{value:!0});var r=s;a.separate=t,a.deSeparate=o}),c=a(function(e,a){function t(e){return e=e.toLowerCase(),0===e.indexOf("http://")?"http://":0===e.indexOf("https://")?"https://":0===e.indexOf("ftp://")?"ftp://":0===e.indexOf("ftps://")?"ftps://":0===e.indexOf("file:///")?"file:///":0===e.indexOf("mailto:")&&"mailto:"}Object.defineProperty(a,"__esModule",{value:!0}),a.default=t}),u=a(function(e,a){function t(e,a){return e.map(function(t,o){var r=encodeURI(t);if(r.indexOf(".")<1&&!l.default(r))return t;var i=null,n=l.default(r)||"";if(a.files&&"file:///"===n&&r.substr(n.length).split(/\/|\\/).length-1?i={reason:"file",protocol:n,raw:t,encoded:r}:n&&(r=r.substr(n.length)),!i&&a.urls&&f.default(r)&&(i={reason:"url",protocol:n?n:"function"==typeof a.defaultProtocol?a.defaultProtocol(t):a.defaultProtocol,raw:t,encoded:r}),!i&&a.emails&&u.default(r)&&(i={reason:"email",protocol:"mailto:",raw:t,encoded:r}),!i&&a.ips&&d.default(r)&&(i={reason:"ip",protocol:n?n:"function"==typeof a.defaultProtocol?a.defaultProtocol(t):a.defaultProtocol,raw:t,encoded:r}),i){return"'"!==e[o-1]&&'"'!==e[o-1]||!~s.htmlAttrs.indexOf(e[o-2])?i:t}return t})}Object.defineProperty(a,"__esModule",{value:!0});var s=o,l=c,u=r,d=i,f=n;a.default=t}),d=a(function(e,a){function t(e,a){var t=r.separate(e),s=n.default(t,a);if(a.list){for(var l=[],c=0;ca.truncate&&(o=o.substring(0,a.truncate)+"..."),"object"==typeof a.truncate&&o.length>a.truncate[0]+a.truncate[1]&&(o=o.substr(0,a.truncate[0])+"..."+o.substr(o.length-a.truncate[1])),void 0===a.attributes&&(a.attributes=[]),'"+o+""}Object.defineProperty(a,"__esModule",{value:!0});var r=l,i=l,n=u;a.default=t}),f=a(function(e,a){Object.defineProperty(a,"__esModule",{value:!0});var o=t,s=r,l=i,u=n,f=d,p=c,m=function(e,a){a=o.defaultOptions(a);var t=f.default(e,a);return t};m.validate={ip:l.default,url:function(e){var a=p.default(e)||"";return e=e.substr(a.length),e=encodeURI(e),u.default(e)},email:s.default},a.default=m}),p=e(f);return p}); \ No newline at end of file diff --git a/dist-node/index.js b/dist-node/index.js index e6bbea0..a9536b5 100644 --- a/dist-node/index.js +++ b/dist-node/index.js @@ -1,12 +1,12 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = require("./util"); -const email_1 = require("./tests/email"); -const ip_1 = require("./tests/ip"); -const url_1 = require("./tests/url"); -const transform_1 = require("./transform/transform"); -const hasprotocol_1 = require("./tests/hasprotocol"); -const anchorme = function (str, options) { +var util_1 = require("./util"); +var email_1 = require("./tests/email"); +var ip_1 = require("./tests/ip"); +var url_1 = require("./tests/url"); +var transform_1 = require("./transform/transform"); +var hasprotocol_1 = require("./tests/hasprotocol"); +var anchorme = function (str, options) { options = util_1.defaultOptions(options); var result = transform_1.default(str, options); return result; diff --git a/dist-node/separate/fix.js b/dist-node/separate/fix.js index 7ecdb6f..6d66ded 100644 --- a/dist-node/separate/fix.js +++ b/dist-node/separate/fix.js @@ -31,7 +31,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function fixSeparators(arr, sep1, sep2) { - arr.forEach((bit, i) => { + arr.forEach(function (bit, i) { if ((bit.indexOf(".") > -1) && (!(arr[i - 1] === sep1 && arr[i + 1] === sep2)) && (arr[i + 1] === sep1 || arr[i + 1] === sep2) // the one after it, is either sep1 or sep2 @@ -53,8 +53,8 @@ exports.fixSeparators = fixSeparators; function default_1(arr) { arr = fixSeparators(arr, "(", ")"); arr = fixSeparators(arr, "[", "]"); - arr = fixSeparators(arr, `"`, `"`); - arr = fixSeparators(arr, `'`, `'`); + arr = fixSeparators(arr, "\"", "\""); + arr = fixSeparators(arr, "'", "'"); return arr; } exports.default = default_1; diff --git a/dist-node/separate/separate.js b/dist-node/separate/separate.js index af33a12..9e90ca5 100644 --- a/dist-node/separate/separate.js +++ b/dist-node/separate/separate.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fix_1 = require("./fix"); +var fix_1 = require("./fix"); /** * * Split the string with word separators diff --git a/dist-node/tests/email.js b/dist-node/tests/email.js index b1d4c00..6ee4a26 100644 --- a/dist-node/tests/email.js +++ b/dist-node/tests/email.js @@ -1,17 +1,17 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const lists_1 = require("../lists"); +var lists_1 = require("../lists"); // pattern that an emails MUST have -const pattern = /^[a-z0-9!#$%&'*+\-/=?^_`{|}~.]+@([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?$/i; +var pattern = /^[a-z0-9!#$%&'*+\-/=?^_`{|}~.]+@([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?$/i; // patterns that an email can not have -const negativePatterns = [ +var negativePatterns = [ /^[!#$%&'*+\-/=?^_`{|}~.]/, /[.]{2,}[a-z0-9!#$%&'*+\-/=?^_`{|}~.]+@/i, /\.@/ ]; function default_1(str) { // general pattern recognition - const match = str.match(pattern); + var match = str.match(pattern); if (match === null) return false; // doesn't have a negative pattern diff --git a/dist-node/tests/hasprotocol.js b/dist-node/tests/hasprotocol.js index 3b0794d..95d9fa6 100644 --- a/dist-node/tests/hasprotocol.js +++ b/dist-node/tests/hasprotocol.js @@ -2,17 +2,17 @@ Object.defineProperty(exports, "__esModule", { value: true }); function default_1(str) { str = str.toLowerCase(); - if (str.startsWith("http://")) + if (str.indexOf("http://") === 0) return "http://"; - else if (str.startsWith("https://")) + else if (str.indexOf("https://") === 0) return "https://"; - else if (str.startsWith("ftp://")) + else if (str.indexOf("ftp://") === 0) return "ftp://"; - else if (str.startsWith("ftps://")) + else if (str.indexOf("ftps://") === 0) return "ftps://"; - else if (str.startsWith("file:///")) + else if (str.indexOf("file:///") === 0) return "file:///"; - else if (str.startsWith("mailto:")) + else if (str.indexOf("mailto:") === 0) return "mailto:"; else return false; diff --git a/dist-node/tests/ip.js b/dist-node/tests/ip.js index 3f788d7..937c942 100644 --- a/dist-node/tests/ip.js +++ b/dist-node/tests/ip.js @@ -1,8 +1,8 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = require("../util"); +var util_1 = require("../util"); // general IP pattern https://regex101.com/r/rzUcJ4/1 -const pattern = /^(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?(\/.*)?$/; +var pattern = /^(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?(\/.*)?$/; function default_1(str) { if (!pattern.test(str)) return false; diff --git a/dist-node/tests/url.js b/dist-node/tests/url.js index 12a6225..d7727c3 100644 --- a/dist-node/tests/url.js +++ b/dist-node/tests/url.js @@ -1,11 +1,11 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = require("../util"); -const lists_1 = require("../lists"); -const pattern = /^(https?:\/\/|ftps?:\/\/)?([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?(:(\d{1,5}))?(\/([a-z0-9\-._~:\/\?#\[\]@!$&'\(\)\*\+,;=%]+)?)?$/i; +var util_1 = require("../util"); +var lists_1 = require("../lists"); +var pattern = /^(https?:\/\/|ftps?:\/\/)?([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?(:(\d{1,5}))?(\/([a-z0-9\-._~:\/\?#\[\]@!$&'\(\)\*\+,;=%]+)?)?$/i; function default_1(str) { // general pattern recognition https://regex101.com/r/RgKTA4/2 - const match = str.match(pattern); + var match = str.match(pattern); if (match === null) return false; // validate TLD diff --git a/dist-node/transform/identify.js b/dist-node/transform/identify.js index ebdbc4f..5a07885 100644 --- a/dist-node/transform/identify.js +++ b/dist-node/transform/identify.js @@ -1,12 +1,12 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const lists_1 = require("../lists"); -const hasprotocol_1 = require("../tests/hasprotocol"); -const email_1 = require("../tests/email"); -const ip_1 = require("../tests/ip"); -const url_1 = require("../tests/url"); +var lists_1 = require("../lists"); +var hasprotocol_1 = require("../tests/hasprotocol"); +var email_1 = require("../tests/email"); +var ip_1 = require("../tests/ip"); +var url_1 = require("../tests/url"); function default_1(inputArr, options) { - return inputArr.map((fragment, index) => { + return inputArr.map(function (fragment, index) { var encoded = encodeURI(fragment); // quick validations // 1 diff --git a/dist-node/transform/transform.js b/dist-node/transform/transform.js index 1f18a55..f258a97 100644 --- a/dist-node/transform/transform.js +++ b/dist-node/transform/transform.js @@ -1,8 +1,8 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const separate_1 = require("../separate/separate"); -const separate_2 = require("../separate/separate"); -const identify_1 = require("./identify"); +var separate_1 = require("../separate/separate"); +var separate_2 = require("../separate/separate"); +var identify_1 = require("./identify"); function default_1(str, options) { var arr = separate_1.separate(str); var identified = identify_1.default(arr, options); @@ -17,7 +17,7 @@ function default_1(str, options) { return listed; } // transform objects to HTML tags - identified = identified.map((fragment) => { + identified = identified.map(function (fragment) { if (typeof fragment === "string") return fragment; return url2tag(fragment, options); @@ -39,16 +39,16 @@ function url2tag(fragment, options) { } if (options.attributes === undefined) options.attributes = []; - return ` { + return "${original}`; + return " " + attribute.name + "=\"" + attribute.value + "\" "; + }).join("") + ">" + original + ""; }