UNPKG

swiper-next

Version:
31 lines (30 loc) 755 B
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const shared = require("@vue/shared"); const index = require("../../shared/index.js"); function hasRpx(str) { str = str + ""; return str.indexOf("rpx") !== -1 || str.indexOf("upx") !== -1; } function rpx2px(str, replace = false) { if (replace) { return rpx2pxWithReplace(str); } if (shared.isString(str)) { const res = parseInt(str) || 0; if (hasRpx(str)) { return index.upx2px(res); } return res; } return str; } function rpx2pxWithReplace(str) { if (!hasRpx(str)) { return str; } return str.replace(/(\d+(\.\d+)?)[ru]px/g, (_a, b) => { return index.upx2px(parseFloat(b)) + "px"; }); } exports.rpx2px = rpx2px;