UNPKG

tdesign-mobile-vue

Version:
120 lines (112 loc) 3.53 kB
/** * tdesign v1.9.3 * (c) 2025 TDesign Group * @license MIT */ 'use strict'; var _arrayIncludesWith = require('./dep-731c3bbd.js'); var _arrayMap = require('./dep-ae809b86.js'); var _baseUnary = require('./dep-4dfb9b9c.js'); var omit = require('./dep-f5ab0e36.js'); var isArrayLikeObject = require('./dep-060bf1cf.js'); /** 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(array, values, iteratee, comparator) { var index = -1, includes = _arrayIncludesWith.arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length; if (!length) { return result; } if (iteratee) { values = _arrayMap.arrayMap(values, _baseUnary.baseUnary(iteratee)); } if (comparator) { includes = _arrayIncludesWith.arrayIncludesWith; isCommon = false; } else if (values.length >= LARGE_ARRAY_SIZE) { includes = _arrayIncludesWith.cacheHas; isCommon = false; values = new _arrayIncludesWith.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; } /** * 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 = isArrayLikeObject.baseRest(function (array, values) { return isArrayLikeObject.isArrayLikeObject(array) ? baseDifference(array, omit.baseFlatten(values, 1, isArrayLikeObject.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); }); } }; } exports.difference = difference$1; exports.mitt = mitt; //# sourceMappingURL=dep-1d13ccfe.js.map