tooot/src/modules/autolinker/match/hashtag-match.js.map

1 line
3.9 KiB
Plaintext

{"version":3,"sources":["../src/match/hashtag-match.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;GASG;AACH;IAAkC,wCAAK;IAkBtC;;;;OAIG;IACH,sBAAa,GAAuB;QAApC,YACC,kBAAO,GAAG,CAAE,SAIZ;QA1BD;;;;;WAKG;QACc,iBAAW,GAAW,EAAE,CAAC,CAAE,gGAAgG;QAE5I;;;;WAIG;QACc,aAAO,GAAW,EAAE,CAAC,CAAE,gGAAgG;QAWvI,KAAI,CAAC,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC;QACnC,KAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;;IAC5B,CAAC;IAGD;;;;;OAKG;IACH,8BAAO,GAAP;QACC,OAAO,SAAS,CAAC;IAClB,CAAC;IAGD;;;;;OAKG;IACH,qCAAc,GAAd;QACC,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAGD;;;;OAIG;IACH,iCAAU,GAAV;QACC,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAGD;;;;OAIG;IACH,oCAAa,GAAb;QACC,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,EAC9B,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE3B,QAAQ,WAAW,EAAG;YACrB,KAAK,SAAS;gBACb,OAAO,8BAA8B,GAAG,OAAO,CAAC;YACjD,KAAK,UAAU;gBACd,OAAO,mCAAmC,GAAG,OAAO,CAAC;YACtD,KAAK,WAAW;gBACf,OAAO,qCAAqC,GAAG,OAAO,CAAC;YAExD,SAAW,uGAAuG;gBACjH,MAAM,IAAI,KAAK,CAAE,4CAA4C,GAAG,WAAW,CAAE,CAAC;SAC/E;IACF,CAAC;IAGD;;;;OAIG;IACH,oCAAa,GAAb;QACC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC;IAC3B,CAAC;IAEF,mBAAC;AAAD,CA/FA,AA+FC,CA/FiC,KAAK,GA+FtC","file":"hashtag-match.js","sourcesContent":["import { Match, MatchConfig } from \"./match\";\n\n/**\n * @class Autolinker.match.Hashtag\n * @extends Autolinker.match.Match\n *\n * Represents a Hashtag match found in an input string which should be\n * Autolinked.\n *\n * See this class's superclass ({@link Autolinker.match.Match}) for more\n * details.\n */\nexport class HashtagMatch extends Match {\n\n\t/**\n\t * @cfg {String} serviceName\n\t *\n\t * The service to point hashtag matches to. See {@link Autolinker#hashtag}\n\t * for available values.\n\t */\n\tprivate readonly serviceName: string = ''; // default value just to get the above doc comment in the ES5 output and documentation generator\n\n\t/**\n\t * @cfg {String} hashtag (required)\n\t *\n\t * The HashtagMatch that was matched, without the '#'.\n\t */\n\tprivate readonly hashtag: string = ''; // default value just to get the above doc comment in the ES5 output and documentation generator\n\n\n\t/**\n\t * @method constructor\n\t * @param {Object} cfg The configuration properties for the Match\n\t * instance, specified in an Object (map).\n\t */\n\tconstructor( cfg: HashtagMatchConfig ) {\n\t\tsuper( cfg );\n\n\t\tthis.serviceName = cfg.serviceName;\n\t\tthis.hashtag = cfg.hashtag;\n\t}\n\n\n\t/**\n\t * Returns a string name for the type of match that this class represents.\n\t * For the case of HashtagMatch, returns 'hashtag'.\n\t *\n\t * @return {String}\n\t */\n\tgetType() {\n\t\treturn 'hashtag';\n\t}\n\n\n\t/**\n\t * Returns the configured {@link #serviceName} to point the HashtagMatch to.\n\t * Ex: 'facebook', 'twitter'.\n\t *\n\t * @return {String}\n\t */\n\tgetServiceName() {\n\t\treturn this.serviceName;\n\t}\n\n\n\t/**\n\t * Returns the matched hashtag, without the '#' character.\n\t *\n\t * @return {String}\n\t */\n\tgetHashtag() {\n\t\treturn this.hashtag;\n\t}\n\n\n\t/**\n\t * Returns the anchor href that should be generated for the match.\n\t *\n\t * @return {String}\n\t */\n\tgetAnchorHref() {\n\t\tlet serviceName = this.serviceName,\n\t\t hashtag = this.hashtag;\n\n\t\tswitch( serviceName ) {\n\t\t\tcase 'twitter' :\n\t\t\t\treturn 'https://twitter.com/hashtag/' + hashtag;\n\t\t\tcase 'facebook' :\n\t\t\t\treturn 'https://www.facebook.com/hashtag/' + hashtag;\n\t\t\tcase 'instagram' :\n\t\t\t\treturn 'https://instagram.com/explore/tags/' + hashtag;\n\n\t\t\tdefault : // Shouldn't happen because Autolinker's constructor should block any invalid values, but just in case.\n\t\t\t\tthrow new Error( 'Unknown service name to point hashtag to: ' + serviceName );\n\t\t}\n\t}\n\n\n\t/**\n\t * Returns the anchor text that should be generated for the match.\n\t *\n\t * @return {String}\n\t */\n\tgetAnchorText() {\n\t\treturn '#' + this.hashtag;\n\t}\n\n}\n\nexport interface HashtagMatchConfig extends MatchConfig {\n\tserviceName: string;\n\thashtag: string;\n}"]}