Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.pre('init', function(next, obj) {
if (mpath.has(name, obj)) {
var _v = mpath.get(name, obj);
if (!this.$$populatedVirtuals) {
this.$$populatedVirtuals = {};
}
if (options.justOne) {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v[0] :
_v;
} else {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v :
_v == null ? [] : [_v];
}
mpath.unset(name, obj);
this.pre('init', function(next, obj) {
if (mpath.has(name, obj)) {
var _v = mpath.get(name, obj);
if (!this.$$populatedVirtuals) {
this.$$populatedVirtuals = {};
}
if (options.justOne) {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v[0] :
_v;
} else {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v :
_v == null ? [] : [_v];
}
mpath.unset(name, obj);
this.pre('init', function(next, obj) {
if (mpath.has(name, obj)) {
var _v = mpath.get(name, obj);
if (!this.$$populatedVirtuals) {
this.$$populatedVirtuals = {};
}
if (options.justOne) {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v[0] :
_v;
} else {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v :
_v == null ? [] : [_v];
}
mpath.unset(name, obj);
this.pre('init', function(obj) {
if (mpath.has(name, obj)) {
var _v = mpath.get(name, obj);
if (!this.$$populatedVirtuals) {
this.$$populatedVirtuals = {};
}
if (options.justOne) {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v[0] :
_v;
} else {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v :
_v == null ? [] : [_v];
}
mpath.unset(name, obj);
this.pre('init', function(obj) {
if (mpath.has(name, obj)) {
const _v = mpath.get(name, obj);
if (!this.$$populatedVirtuals) {
this.$$populatedVirtuals = {};
}
if (options.justOne || options.count) {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v[0] :
_v;
} else {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v :
_v == null ? [] : [_v];
}
mpath.unset(name, obj);
this.pre('init', function(obj) {
if (mpath.has(name, obj)) {
const _v = mpath.get(name, obj);
if (!this.$$populatedVirtuals) {
this.$$populatedVirtuals = {};
}
if (options.justOne || options.count) {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v[0] :
_v;
} else {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v :
_v == null ? [] : [_v];
}
mpath.unset(name, obj);
this.pre('init', function(obj) {
if (mpath.has(name, obj)) {
const _v = mpath.get(name, obj);
if (!this.$$populatedVirtuals) {
this.$$populatedVirtuals = {};
}
if (options.justOne || options.count) {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v[0] :
_v;
} else {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v :
_v == null ? [] : [_v];
}
mpath.unset(name, obj);
this.pre('init', function(obj) {
if (mpath.has(name, obj)) {
var _v = mpath.get(name, obj);
if (!this.$$populatedVirtuals) {
this.$$populatedVirtuals = {};
}
if (options.justOne) {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v[0] :
_v;
} else {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v :
_v == null ? [] : [_v];
}
mpath.unset(name, obj);
this.pre('init', function(obj) {
if (mpath.has(name, obj)) {
const _v = mpath.get(name, obj);
if (!this.$$populatedVirtuals) {
this.$$populatedVirtuals = {};
}
if (options.justOne || options.count) {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v[0] :
_v;
} else {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v :
_v == null ? [] : [_v];
}
mpath.unset(name, obj);
this.pre('init', function(obj) {
if (mpath.has(name, obj)) {
var _v = mpath.get(name, obj);
if (!this.$$populatedVirtuals) {
this.$$populatedVirtuals = {};
}
if (options.justOne) {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v[0] :
_v;
} else {
this.$$populatedVirtuals[name] = Array.isArray(_v) ?
_v :
_v == null ? [] : [_v];
}
mpath.unset(name, obj);