mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 10:52:47 +00:00
updated bunch of file paths and changed the way posts are loaded
This commit is contained in:
45
node_modules/mongoose/lib/schema/date.js
generated
vendored
45
node_modules/mongoose/lib/schema/date.js
generated
vendored
@@ -2,7 +2,7 @@
|
||||
* Module requirements.
|
||||
*/
|
||||
|
||||
var errorMessages = require('../error').messages
|
||||
var errorMessages = require('../error').messages;
|
||||
var utils = require('../utils');
|
||||
|
||||
var SchemaType = require('../schematype');
|
||||
@@ -18,7 +18,7 @@ var CastError = SchemaType.CastError;
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function SchemaDate (key, options) {
|
||||
function SchemaDate(key, options) {
|
||||
SchemaType.call(this, key, options, 'Date');
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ SchemaDate.prototype.constructor = SchemaDate;
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SchemaDate.prototype.expires = function (when) {
|
||||
SchemaDate.prototype.expires = function(when) {
|
||||
if (!this._index || 'Object' !== this._index.constructor.name) {
|
||||
this._index = {};
|
||||
}
|
||||
@@ -83,7 +83,7 @@ SchemaDate.prototype.expires = function (when) {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SchemaDate.prototype.checkRequired = function (value) {
|
||||
SchemaDate.prototype.checkRequired = function(value) {
|
||||
return value instanceof Date;
|
||||
};
|
||||
|
||||
@@ -118,9 +118,9 @@ SchemaDate.prototype.checkRequired = function (value) {
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SchemaDate.prototype.min = function (value, message) {
|
||||
SchemaDate.prototype.min = function(value, message) {
|
||||
if (this.minValidator) {
|
||||
this.validators = this.validators.filter(function (v) {
|
||||
this.validators = this.validators.filter(function(v) {
|
||||
return v.validator != this.minValidator;
|
||||
}, this);
|
||||
}
|
||||
@@ -130,12 +130,13 @@ SchemaDate.prototype.min = function (value, message) {
|
||||
msg = msg.replace(/{MIN}/, (value === Date.now ? 'Date.now()' : this.cast(value).toString()));
|
||||
var self = this;
|
||||
this.validators.push({
|
||||
validator: this.minValidator = function (val) {
|
||||
validator: this.minValidator = function(val) {
|
||||
var min = (value === Date.now ? value() : self.cast(value));
|
||||
return val === null || val.valueOf() >= min.valueOf();
|
||||
},
|
||||
message: msg,
|
||||
type: 'min'
|
||||
type: 'min',
|
||||
min: value
|
||||
});
|
||||
}
|
||||
|
||||
@@ -173,9 +174,9 @@ SchemaDate.prototype.min = function (value, message) {
|
||||
* @api public
|
||||
*/
|
||||
|
||||
SchemaDate.prototype.max = function (value, message) {
|
||||
SchemaDate.prototype.max = function(value, message) {
|
||||
if (this.maxValidator) {
|
||||
this.validators = this.validators.filter(function(v){
|
||||
this.validators = this.validators.filter(function(v) {
|
||||
return v.validator != this.maxValidator;
|
||||
}, this);
|
||||
}
|
||||
@@ -190,7 +191,8 @@ SchemaDate.prototype.max = function (value, message) {
|
||||
return val === null || val.valueOf() <= max.valueOf();
|
||||
},
|
||||
message: msg,
|
||||
type: 'max'
|
||||
type: 'max',
|
||||
max: value
|
||||
});
|
||||
}
|
||||
|
||||
@@ -204,10 +206,10 @@ SchemaDate.prototype.max = function (value, message) {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SchemaDate.prototype.cast = function (value) {
|
||||
SchemaDate.prototype.cast = function(value) {
|
||||
// If null or undefined
|
||||
if (value == null || value === '')
|
||||
return value;
|
||||
return null;
|
||||
|
||||
if (value instanceof Date)
|
||||
return value;
|
||||
@@ -238,27 +240,16 @@ SchemaDate.prototype.cast = function (value) {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function handleSingle (val) {
|
||||
function handleSingle(val) {
|
||||
return this.cast(val);
|
||||
}
|
||||
|
||||
function handleArray (val) {
|
||||
var self = this;
|
||||
return val.map( function (m) {
|
||||
return self.cast(m);
|
||||
});
|
||||
}
|
||||
|
||||
SchemaDate.prototype.$conditionalHandlers =
|
||||
utils.options(SchemaType.prototype.$conditionalHandlers, {
|
||||
'$all': handleArray,
|
||||
'$gt': handleSingle,
|
||||
'$gte': handleSingle,
|
||||
'$in': handleArray,
|
||||
'$lt': handleSingle,
|
||||
'$lte': handleSingle,
|
||||
'$ne': handleSingle,
|
||||
'$nin': handleArray
|
||||
'$lte': handleSingle
|
||||
});
|
||||
|
||||
|
||||
@@ -270,7 +261,7 @@ SchemaDate.prototype.$conditionalHandlers =
|
||||
* @api private
|
||||
*/
|
||||
|
||||
SchemaDate.prototype.castForQuery = function ($conditional, val) {
|
||||
SchemaDate.prototype.castForQuery = function($conditional, val) {
|
||||
var handler;
|
||||
|
||||
if (2 !== arguments.length) {
|
||||
|
||||
Reference in New Issue
Block a user