function _isEmpty(v) {
  if (v == null) {
    return true;
  }
  if (typeof v !== 'object' || Array.isArray(v)) {
    return false;
  }
  for (const key of Object.keys(v)) {
    if (!_isEmpty(v[key])) {
      return false;
    }
  }
  return true;
}
Returns true if the given path is nullish or only contains empty objects.
Useful for determining whether this subdoc will get stripped out by the
[minimize option](https://mongoosejs.com/docs/guide.html#minimize).

#### Example:

    const schema = new Schema({ nested: { foo: String } });
    const Model = mongoose.model('Test', schema);
    const doc = new Model({});
    doc.$isEmpty('nested'); // true
    doc.nested.$isEmpty(); // true

    doc.nested.foo = 'bar';
    doc.$isEmpty('nested'); // false
    doc.nested.$isEmpty(); // false

@param {String} [path]
@memberOf Document
@instance
@api public
@method $isEmpty
@return {Boolean}