tdesign-vue
Version:
148 lines (131 loc) • 4.52 kB
JavaScript
/**
* tdesign v1.15.0
* (c) 2026 tdesign
* @license MIT
*/
;
var toString = require('./dep-689d381f.js');
var _baseClone = require('./dep-594e0165.js');
var _typeof = require('@babel/runtime/helpers/typeof');
var _baseGet = require('./dep-1e173c2b.js');
var last = require('./dep-da2ef9c3.js');
var _baseSlice = require('./dep-49400b00.js');
var _initCloneObject = require('./dep-124386d4.js');
var isPlainObject = require('./dep-d66ab3a4.js');
var _flatRest = require('./dep-a96e5563.js');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
/**
* 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, see: https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
var index = -1,
length = path.length;
if (!length) {
return true;
}
var isRootPrimitive = object == null || _typeof__default["default"](object) !== 'object' && typeof object !== 'function';
while (++index < length) {
var key = path[index];
// skip non-string keys (e.g., Symbols, numbers)
if (typeof key !== 'string') {
continue;
}
// Always block "__proto__" anywhere in the path if it's not expected
if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
return false;
}
// Block "constructor.prototype" chains
if (key === 'constructor' && index + 1 < length && typeof path[index + 1] === 'string' && path[index + 1] === 'prototype') {
// Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a')
if (isRootPrimitive && index === 0) {
continue;
}
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 isPlainObject.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, _baseClone.getAllKeysIn(object), result);
if (isDeep) {
result = _baseClone.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.omit = omit$1;
//# sourceMappingURL=dep-2c32d315.js.map