UNPKG

843 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.hashtagServices = exports.isValidHashtag = exports.isHashtagTextChar = void 0;
4var regex_lib_1 = require("../regex-lib");
5/**
6 * Determines if the given `char` is a an allowed character in a hashtag. These
7 * are underscores or any alphanumeric char.
8 */
9function isHashtagTextChar(char) {
10 return char === '_' || regex_lib_1.alphaNumericAndMarksRe.test(char);
11}
12exports.isHashtagTextChar = isHashtagTextChar;
13/**
14 * Determines if a hashtag match is valid.
15 */
16function isValidHashtag(hashtag) {
17 // Max length of 140 for a hashtag ('#' char + 139 word chars)
18 return hashtag.length <= 140;
19}
20exports.isValidHashtag = isValidHashtag;
21exports.hashtagServices = ['twitter', 'facebook', 'instagram', 'tiktok'];
22//# sourceMappingURL=hashtag-utils.js.map
\No newline at end of file