UNPKG

tdesign-mobile-vue

Version:
232 lines (208 loc) 6.64 kB
/** * tdesign v1.7.0 * (c) 2024 TDesign Group * @license MIT */ import './dep-8bf3054e.mjs'; import { i as isArray_1 } from './dep-019e292f.mjs'; import './dep-32364550.mjs'; import { _ as _typeof } from './dep-620d73f7.mjs'; import { i as isSymbol_1 } from './dep-a836a38c.mjs'; import { _ as _MapCache } from './dep-89951f45.mjs'; import { t as toString_1 } from './dep-8140c29b.mjs'; var isArray$1 = isArray_1, isSymbol$1 = isSymbol_1; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/; /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey$1(value, object) { if (isArray$1(value)) { return false; } var type = _typeof(value); if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol$1(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); } var _isKey = isKey$1; var MapCache = _MapCache; /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `clear`, `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize$1(func, resolver) { if (typeof func != 'function' || resolver != null && typeof resolver != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } var _memoized = function memoized() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = _memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); _memoized.cache = cache.set(key, result) || cache; return result; }; _memoized.cache = new (memoize$1.Cache || MapCache)(); return _memoized; } // Expose `MapCache`. memoize$1.Cache = MapCache; var memoize_1 = memoize$1; var memoize = memoize_1; /** Used as the maximum memoize cache size. */ var MAX_MEMOIZE_SIZE = 500; /** * A specialized version of `_.memoize` which clears the memoized function's * cache when it exceeds `MAX_MEMOIZE_SIZE`. * * @private * @param {Function} func The function to have its output memoized. * @returns {Function} Returns the new memoized function. */ function memoizeCapped$1(func) { var result = memoize(func, function (key) { if (cache.size === MAX_MEMOIZE_SIZE) { cache.clear(); } return key; }); var cache = result.cache; return result; } var _memoizeCapped = memoizeCapped$1; var memoizeCapped = _memoizeCapped; /** Used to match property names within property paths. */ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ var stringToPath$1 = memoizeCapped(function (string) { var result = []; if (string.charCodeAt(0) === 46 /* . */) { result.push(''); } string.replace(rePropName, function (match, number, quote, subString) { result.push(quote ? subString.replace(reEscapeChar, '$1') : number || match); }); return result; }); var _stringToPath = stringToPath$1; var isArray = isArray_1, isKey = _isKey, stringToPath = _stringToPath, toString = toString_1; /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @param {Object} [object] The object to query keys on. * @returns {Array} Returns the cast property path array. */ function castPath$1(value, object) { if (isArray(value)) { return value; } return isKey(value, object) ? [value] : stringToPath(toString(value)); } var _castPath = castPath$1; var isSymbol = isSymbol_1; /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey$1(value) { if (typeof value == 'string' || isSymbol(value)) { return value; } var result = value + ''; return result == '0' && 1 / value == -INFINITY ? '-0' : result; } var _toKey = toKey$1; var castPath = _castPath, toKey = _toKey; /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = castPath(path, object); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return index && index == length ? object : undefined; } var _baseGet = baseGet; export { _baseGet as _, _castPath as a, _toKey as b }; //# sourceMappingURL=dep-c51d4905.mjs.map