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/wincloud_gateway/node_modules/mongoose/lib/schema/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
/*!
* ignore
*/
const MongooseMap = require('../types/map');
const SchemaMapOptions = require('../options/SchemaMapOptions');
const SchemaType = require('../schematype');
/*!
* ignore
*/
class Map extends SchemaType {
constructor(key, options) {
super(key, options, 'Map');
this.$isSchemaMap = true;
}
set(option, value) {
return SchemaType.set(option, value);
}
cast(val, doc, init) {
if (val instanceof MongooseMap) {
return val;
}
if (init) {
const map = new MongooseMap({}, this.path, doc, this.$__schemaType);
if (val instanceof global.Map) {
for (const key of val.keys()) {
let _val = val.get(key);
if (_val == null) {
_val = map.$__schemaType._castNullish(_val);
} else {
_val = map.$__schemaType.cast(_val, doc, true);
}
map.$init(key, _val);
}
} else {
for (const key of Object.keys(val)) {
let _val = val[key];
if (_val == null) {
_val = map.$__schemaType._castNullish(_val);
} else {
_val = map.$__schemaType.cast(_val, doc, true);
}
map.$init(key, _val);
}
}
return map;
}
return new MongooseMap(val, this.path, doc, this.$__schemaType);
}
clone() {
const schematype = super.clone();
if (this.$__schemaType != null) {
schematype.$__schemaType = this.$__schemaType.clone();
}
return schematype;
}
}
Map.prototype.OptionsConstructor = SchemaMapOptions;
Map.defaultOptions = {};
module.exports = Map;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0343 ]-- |