image.js
376 Bytes
/**
* 图片格式化
* @param {[String]} url
* @param {[Number]} width
* @param {[Number]} height
* @param {[String]} mode
* @return {[boolen]}
*/
module.exports = function(url, width, height, mode) {
mode = parseInt(mode, 10) ? mode : 2;
url = url || '';
return url.replace(/{width}/g, width).replace(/{height}/g, height).replace(/{mode}/g, mode);
};