UNPKG

vant-fork

Version:

Lightweight Mobile UI Components built on Vue

40 lines (32 loc) 867 B
import Vue from 'vue'; var isServer = Vue.prototype.$isServer; function isDef(value) { return value !== undefined && value !== null; } function isObj(x) { var type = typeof x; return x !== null && (type === 'object' || type === 'function'); } function get(object, path) { var keys = path.split('.'); var result = object; keys.forEach(function (key) { result = isDef(result[key]) ? result[key] : ''; }); return result; } var camelizeRE = /-(\w)/g; function camelize(str) { return str.replace(camelizeRE, function (_, c) { return c.toUpperCase(); }); } function isAndroid() { /* istanbul ignore next */ return isServer ? false : /android/.test(navigator.userAgent.toLowerCase()); } function range(num, min, max) { return Math.min(Math.max(num, min), max); } ; export { get, range, isObj, isDef, isServer, camelize, isAndroid };