{"size": 607, "ext": "js", "max_stars_repo_path": "utils/helper.js", "max_stars_repo_name": "wangbaiyuan/hexo-theme-snippet-pro", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "utils/helper.js", "max_issues_repo_name": "wangbaiyuan/hexo-theme-snippet-pro", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "utils/helper.js", "max_forks_repo_name": "wangbaiyuan/hexo-theme-snippet-pro", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.28, "max_line_length": 63, "alphanum_fraction": 0.5634266886}
const md5 = require('md5');

function lazyImage(post) {
    if(!post.content) {
        return undefined;
    }
    var content = post.content.toString();
    var imgRe = /<img.*?\ssrc\s*=\s*[\'\"]\S+[\'\"]\s.*?>/gim;
    var urlRe = /(http:|https:|\/|\.)\S+(?=["|']\s)/i;
    var imgUrlsArr = content.match(imgRe);
    var data = [];
    imgUrlsArr && imgUrlsArr.forEach(function(item) {
        item.match(urlRe) && data.push(item.match(urlRe)[0]);
    });
    return data;
}
const hashIdOfPost = (post) => post.abbrlink || md5(post.slug);


module.exports = {
    hashIdOfPost,
    lazyImage,
    md5,
}
