UNPKG

tdesign-mobile-vue

Version:
131 lines (122 loc) 3.85 kB
/** * tdesign v1.7.0 * (c) 2024 TDesign Group * @license MIT */ import './dep-8bf3054e.mjs'; import { _ as _SetCache, a as _arrayIncludes, b as _arrayIncludesWith, c as _cacheHas } from './dep-e3b1d449.mjs'; import { _ as _arrayMap } from './dep-0d52e58f.mjs'; import { _ as _baseUnary } from './dep-b84be35c.mjs'; import { _ as _baseFlatten } from './dep-55c9adc0.mjs'; import { _ as _baseRest, i as isArrayLikeObject_1 } from './dep-154c1925.mjs'; var SetCache = _SetCache, arrayIncludes = _arrayIncludes, arrayIncludesWith = _arrayIncludesWith, arrayMap = _arrayMap, baseUnary = _baseUnary, cacheHas = _cacheHas; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** * The base implementation of methods like `_.difference` without support * for excluding multiple arrays or iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Array} values The values to exclude. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. */ function baseDifference$1(array, values, iteratee, comparator) { var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length; if (!length) { return result; } if (iteratee) { values = arrayMap(values, baseUnary(iteratee)); } if (comparator) { includes = arrayIncludesWith; isCommon = false; } else if (values.length >= LARGE_ARRAY_SIZE) { includes = cacheHas; isCommon = false; values = new SetCache(values); } outer: while (++index < length) { var value = array[index], computed = iteratee == null ? value : iteratee(value); value = comparator || value !== 0 ? value : 0; if (isCommon && computed === computed) { var valuesIndex = valuesLength; while (valuesIndex--) { if (values[valuesIndex] === computed) { continue outer; } } result.push(value); } else if (!includes(values, computed, comparator)) { result.push(value); } } return result; } var _baseDifference = baseDifference$1; var baseDifference = _baseDifference, baseFlatten = _baseFlatten, baseRest = _baseRest, isArrayLikeObject = isArrayLikeObject_1; /** * Creates an array of `array` values not included in the other given arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. The order and references of result values are * determined by the first array. * * **Note:** Unlike `_.pullAll`, this method returns a new array. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. * @see _.without, _.xor * @example * * _.difference([2, 1], [2, 3]); * // => [1] */ var difference = baseRest(function (array, values) { return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : []; }); var difference_1 = difference; function mitt (n) { return { all: n = n || new Map(), on: function on(t, e) { var i = n.get(t); i ? i.push(e) : n.set(t, [e]); }, off: function off(t, e) { var i = n.get(t); i && (e ? i.splice(i.indexOf(e) >>> 0, 1) : n.set(t, [])); }, emit: function emit(t, e) { var i = n.get(t); i && i.slice().map(function (n) { n(e); }), (i = n.get("*")) && i.slice().map(function (n) { n(t, e); }); } }; } export { difference_1 as d, mitt as m }; //# sourceMappingURL=dep-9496fb7c.mjs.map