tdesign-vue-next
Version:
TDesign Component for vue-next
137 lines (123 loc) • 4.08 kB
JavaScript
/**
* tdesign v1.20.2
* (c) 2026 tdesign
* @license MIT
*/
;
var toString = require('./dep-0a17438d.js');
var cloneDeep = require('./dep-141cbae1.js');
var _baseGet = require('./dep-e25ae470.js');
var last = require('./dep-648bfb84.js');
var _baseSlice = require('./dep-f9bc7c82.js');
var _initCloneObject = require('./dep-39529ef1.js');
var configProvider_utils_context = require('./dep-31abb282.js');
var _flatRest = require('./dep-4e2907e0.js');
/**
* Gets the parent value at `path` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} path The path to get the parent value of.
* @returns {*} Returns the parent value.
*/
function parent(object, path) {
return path.length < 2 ? object : _baseGet.baseGet(object, _baseSlice.baseSlice(path, 0, -1));
}
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* The base implementation of `_.unset`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The property path to unset.
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
path = _baseGet.castPath(path, object);
// Prevent prototype pollution:
// https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
// https://github.com/lodash/lodash/security/advisories/GHSA-f23m-r3pf-42rh
var index = -1,
length = path.length;
if (!length) {
return true;
}
while (++index < length) {
var key = _baseGet.toKey(path[index]);
// Always block "__proto__" anywhere in the path if it's not expected
if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
return false;
}
// Block constructor/prototype as non-terminal traversal keys to prevent
// escaping the object graph into built-in constructors and prototypes.
if ((key === 'constructor' || key === 'prototype') && index < length - 1) {
return false;
}
}
var obj = parent(object, path);
return obj == null || delete obj[_baseGet.toKey(last.last(path))];
}
/**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects.
*
* @private
* @param {*} value The value to inspect.
* @param {string} key The key of the property to inspect.
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
*/
function customOmitClone(value) {
return configProvider_utils_context.isPlainObject(value) ? undefined : value;
}
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_FLAT_FLAG = 2,
CLONE_SYMBOLS_FLAG = 4;
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted.
*
* **Note:** This method is considerably slower than `_.pick`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to omit.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
var omit = _flatRest.flatRest(function (object, paths) {
var result = {};
if (object == null) {
return result;
}
var isDeep = false;
paths = toString.arrayMap(paths, function (path) {
path = _baseGet.castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
_initCloneObject.copyObject(object, cloneDeep.getAllKeysIn(object), result);
if (isDeep) {
result = cloneDeep.baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length = paths.length;
while (length--) {
baseUnset(result, paths[length]);
}
return result;
});
var omit$1 = omit;
exports.baseUnset = baseUnset;
exports.omit = omit$1;
//# sourceMappingURL=dep-3a800699.js.map