"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const _castPath = require("./_castPath.js");
const last = require("./last.js");
const _parent = require("./_parent.js");
const _toKey = require("./_toKey.js");
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
function baseUnset(object, path) {
  path = _castPath.default(path, object);
  var index = -1, length = path.length;
  if (!length) {
    return true;
  }
  while (++index < length) {
    var key = _toKey.default(path[index]);
    if (key === "__proto__" && !hasOwnProperty.call(object, "__proto__")) {
      return false;
    }
    if ((key === "constructor" || key === "prototype") && index < length - 1) {
      return false;
    }
  }
  var obj = _parent.default(object, path);
  return obj == null || delete obj[_toKey.default(last.default(path))];
}
exports.default = baseUnset;
