UNPKG

dtable-utils

Version:

dtable common utils

25 lines (21 loc) 610 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var formatTextToImage = function formatTextToImage(value) { if (!value || !value.trim()) { return null; } var imageUrl = value.trim(); var imageUrls = imageUrl.split(' '); imageUrls = imageUrls.filter(function (item) { var strUrl = item.match(/http:\/\/.+/); if (!strUrl) { return false; } if (!/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(item)) { return false; } return true; }); return imageUrls.length > 0 ? imageUrls : null; }; exports.formatTextToImage = formatTextToImage;