{"size": 872, "ext": "js", "max_stars_repo_path": "lib/index.js", "max_stars_repo_name": "IonicaBizau/starts-with-emoji", "max_stars_repo_stars_event_min_datetime": "2017-04-17T18:37:21.000Z", "max_stars_repo_stars_event_max_datetime": "2019-02-26T05:42:55.000Z", "max_issues_repo_path": "lib/index.js", "max_issues_repo_name": "IonicaBizau/starts-with-emoji", "max_issues_repo_issues_event_min_datetime": "2020-10-08T13:27:30.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-13T22:15:58.000Z", "max_forks_repo_path": "lib/index.js", "max_forks_repo_name": "IonicaBizau/starts-with-emoji", "max_forks_repo_forks_event_min_datetime": "2020-10-08T15:10:50.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-08T15:10:50.000Z"}
{"max_stars_count": 2, "max_issues_count": 2, "max_forks_count": 1, "avg_line_length": 24.2222222222, "max_line_length": 97, "alphanum_fraction": 0.6766055046}
const regexEmoji = require("regex-emoji")
    , regexParser = require("regex-parser")
    ;

const REGEX_EMOJI = regexParser("/^" + regexEmoji().toString().substring(1));

/**
 * startsWithEmoji
 * Checks if a string starts with emoji.
 *
 * @name startsWithEmoji
 * @function
 * @param {String} s The input string.
 * @return {undefined|String} If the string starts with `:emoji:` return `:emoji:` else undefined
 */
module.exports = function startsWithEmoji(s) {
    REGEX_EMOJI.lastIndex = 0;

    var isEmojiAtStart = REGEX_EMOJI.test(s)

    // if emoji is not at the start return undefined
    return isEmojiAtStart ? s.match(regexEmoji())[0] : undefined
};

/**
 * regex
 * Starts with emoji regex.
 *
 * @name regex
 * @function
 * @return {RegExp} The regex value.
 */
module.exports.regex = function () {
    REGEX_EMOJI.lastIndex = 0;
    return REGEX_EMOJI;
};