mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
Updated mongoose
This commit is contained in:
32
node_modules/mongoose/lib/schema/mixed.js
generated
vendored
32
node_modules/mongoose/lib/schema/mixed.js
generated
vendored
@ -15,7 +15,7 @@ var utils = require('../utils');
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function Mixed (path, options) {
|
||||
function Mixed(path, options) {
|
||||
if (options && options.default) {
|
||||
var def = options.default;
|
||||
if (Array.isArray(def) && 0 === def.length) {
|
||||
@ -25,20 +25,28 @@ function Mixed (path, options) {
|
||||
utils.isObject(def) &&
|
||||
0 === Object.keys(def).length) {
|
||||
// prevent odd "shared" objects between documents
|
||||
options.default = function () {
|
||||
return {}
|
||||
}
|
||||
options.default = function() {
|
||||
return {};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
SchemaType.call(this, path, options);
|
||||
};
|
||||
SchemaType.call(this, path, options, 'Mixed');
|
||||
}
|
||||
|
||||
/**
|
||||
* This schema type's name, to defend against minifiers that mangle
|
||||
* function names.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
Mixed.schemaName = 'Mixed';
|
||||
|
||||
/*!
|
||||
* Inherits from SchemaType.
|
||||
*/
|
||||
|
||||
Mixed.prototype.__proto__ = SchemaType.prototype;
|
||||
Mixed.prototype = Object.create( SchemaType.prototype );
|
||||
Mixed.prototype.constructor = Mixed;
|
||||
|
||||
/**
|
||||
* Required validator
|
||||
@ -46,8 +54,8 @@ Mixed.prototype.__proto__ = SchemaType.prototype;
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Mixed.prototype.checkRequired = function (val) {
|
||||
return true;
|
||||
Mixed.prototype.checkRequired = function(val) {
|
||||
return (val !== undefined) && (val !== null);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -59,7 +67,7 @@ Mixed.prototype.checkRequired = function (val) {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Mixed.prototype.cast = function (val) {
|
||||
Mixed.prototype.cast = function(val) {
|
||||
return val;
|
||||
};
|
||||
|
||||
@ -71,7 +79,7 @@ Mixed.prototype.cast = function (val) {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Mixed.prototype.castForQuery = function ($cond, val) {
|
||||
Mixed.prototype.castForQuery = function($cond, val) {
|
||||
if (arguments.length === 2) return val;
|
||||
return $cond;
|
||||
};
|
||||
|
Reference in New Issue
Block a user