gplink
Version:
This is a Angular Library which provide pipe to convert the url, email and mobile number to link format by using linkifyjs.
2 lines • 1.37 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("linkifyjs/string")):"function"==typeof define&&define.amd?define("gplink",["exports","@angular/core","linkifyjs/string"],t):t(e.gplink={},e.ng.core,e.linkifyStr)}(this,function(e,t,a){"use strict";a=a&&a.hasOwnProperty("default")?a["default"]:a;var r=function(){function e(){}return e.prototype.transform=function(e,t){e=e?a(e,{target:"_system"}):e;var r=new RegExp(t||"^[\\+]?[(]?[0-9]{3}[)]?[-\\s.]?[0-9]{3}[-\\s\\.]?[0-9]{4,6}$","igm");if(e.includes("+")){var n=e?e.split("+"):[];if(0<n.length){for(var o="",i=0;i<n.length;i++)o+=this.getAnchoredNumber(n[i],r,!0);e=o}}else e.includes(" ")?e=this.getAnchoredNumber(e,r,!1):e.match(r)&&(e="<a href=tel:+"+e+" target='_top'>"+e+"</a>");return e},e.prototype.getAnchoredNumber=function(e,t,r){var n=e?e.split(" "):[];if(0<n.length){for(var o=0;o<n.length;o++)n[o].match(t)&&(n[o]=r?"<a href=tel:+"+n[o]+" target='_top'>+"+n[o]+"</a>":"<a href=tel:"+n[o]+" target='_top'>"+n[o]+"</a>");e=n.join(" ")}return e},e.decorators=[{type:t.Pipe,args:[{name:"gplink"}]}],e}(),n=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{declarations:[r],imports:[],exports:[r]}]}],e}();e.GplinkModule=n,e.ɵa=r,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=gplink.umd.min.js.map