!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/OTapi/node_modules/mongoose/lib/helpers/document/   drwxr-xr-x
Free 13.08 GB of 57.97 GB (22.56%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     getEmbeddedDiscriminatorPath.js (1.81 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
'use strict';

const get = require('../get');
const getSchemaDiscriminatorByValue = require('../discriminator/getSchemaDiscriminatorByValue');

/**
 * Like `schema.path()`, except with a document, because impossible to
 * determine path type without knowing the embedded discriminator key.
 *
 * @param {Document} doc
 * @param {String|String[]} path
 * @param {Object} [options]
 * @api private
 */

module.exports = function getEmbeddedDiscriminatorPath(doc, path, options) {
  options = options || {};
  const typeOnly = options.typeOnly;
  const parts = Array.isArray(path) ?
    path :
    (path.indexOf('.') === -1 ? [path] : path.split('.'));
  let schemaType = null;
  let type = 'adhocOrUndefined';

  const schema = getSchemaDiscriminatorByValue(doc.schema, doc.get(doc.schema.options.discriminatorKey)) || doc.schema;

  for (let i = 0; i < parts.length; ++i) {
    const subpath = parts.slice(0, i + 1).join('.');
    schemaType = schema.path(subpath);
    if (schemaType == null) {
      type = 'adhocOrUndefined';
      continue;
    }
    if (schemaType.instance === 'Mixed') {
      return typeOnly ? 'real' : schemaType;
    }
    type = schema.pathType(subpath);
    if ((schemaType.$isSingleNested || schemaType.$isMongooseDocumentArrayElement) &&
    schemaType.schema.discriminators != null) {
      const discriminators = schemaType.schema.discriminators;
      const discriminatorKey = doc.get(subpath + '.' +
        get(schemaType, 'schema.options.discriminatorKey'));
      if (discriminatorKey == null || discriminators[discriminatorKey] == null) {
        continue;
      }
      const rest = parts.slice(i + 1).join('.');
      return getEmbeddedDiscriminatorPath(doc.get(subpath), rest, options);
    }
  }

  // Are we getting the whole schema or just the type, 'real', 'nested', etc.
  return typeOnly ? type : schemaType;
};

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0236 ]--