dtable-utils
Version:
dtable common utils
21 lines (19 loc) • 514 B
JavaScript
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;
};
export { formatTextToImage };