.then(function (response) { var data = response.data; instance.set({ promotionAmount: toNumber(data.balance, 0), walletBalance: toNumber(data.normal_balance, 0), hasPayPassword: data.has_password }); });
function () { var element = $(this); var url = element.attr('data-src'); var width = toNumber(element.attr('data-width'), 0); var height = toNumber(element.attr('data-height'), 0); var noCrop = !toNumber(element.attr('data-crop'), 0); if (width > 0 && height > 0) { var url1x = compressImage({ url: url, width: width, height: height, noCrop: noCrop }); var url2x = compressImage({ url: url, width: 2 * width, height: 2 * height, noCrop: noCrop }); var url3x = compressImage({ url: url, width: 3 * width, height: 3 * height, noCrop: noCrop }); var retinaSet = [ url2x + ' 2x', url3x + ' 3x' ]; element .prop({ src: url1x, srcset: retinaSet.join(',') }) .removeAttr('data-src'); } }
exports.toNumber = function (value) { return toNumber(value, null); };